note 97003 rejected from function.spl-autoload-register by danbrown

From: Date: Sat, 27 Mar 2010 14:46:57 +0000
Subject: note 97003 rejected from function.spl-autoload-register by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167451@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- This fails everytime under PHP 5.3 with uncaught exception, Function auload not found. It only works if last line is changed to spl_autoload_register( '\henry\auload' ); and that seems just wrong because the first line should already put us within the "henry" namespace, no? <?php namespace henry; function auload( $ClassNameToLoad ) { $classes = array( 'ClassName1' => 'Classes/ClassName1.php', 'ClassName2' => 'Classes/ClassName2.php', ); if( $classes[ $ClassNameToLoad ] ) { include( '/hd/path/'. $classes[ $ClassNameToLoad ] ); } } spl_autoload_register( 'auload' ); ?>

« previous php.notes (#167451) next »