note 62706 deleted from language.oop5.autoload by felipe

From: Date: Mon, 24 Mar 2008 22:34:15 +0000
Subject: note 62706 deleted from language.oop5.autoload by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137498@lists.php.net to get a copy of this message
Note Submitter: steven at gandso dot com ---- An alternative to __autoload for PHP4. <?php /** * Set the variable **/ $string = ""; /** * Find pathnames matching the pattern **/ foreach( glob( $_SERVER['DOCUMENT_ROOT'] . "/classes/class.*.inc" ) as $filename ) { /** * Include and evaluates the specific file **/ require_once( $filename ); /** * Get the classnames **/ if( preg_match( "/class\\.(.+?)\\.inc/", $filename, $className ) ) { /** * Create a variable of the desired type with the 'new' operator **/ $string .= "$" . $className[1] . " = new " . ucfirst( $className[1] ) . ";"; } } /** * Evaluate the string as PHP code **/ eval( $string ); ?>

« previous php.notes (#137498) next »