note 62706 added to language.oop5.autoload
| From: | stevenatgandsodotcom at osu1 dot php dot net | Date: | Tue, 07 Mar 2006 20:10:04 +0000 |
| Subject: | note 62706 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105013@lists.php.net to get a copy of this message | ||
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 );
?>
----
Server IP: 194.239.128.8
Probable Submitter: 131.165.177.65
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- http://master.php.net/note/edit/62706
Del: integrated -- http://master.php.net/note/delete/62706/integrated
Del: useless -- http://master.php.net/note/delete/62706/useless
Del: bad code -- http://master.php.net/note/delete/62706/bad+code
Del: spam -- http://master.php.net/note/delete/62706/spam
Del: non-english -- http://master.php.net/note/delete/62706/non-english
Del: in docs -- http://master.php.net/note/delete/62706/in+docs
Del: other reasons-- http://master.php.net/note/delete/62706
Reject -- http://master.php.net/note/reject/62706
Search -- http://master.php.net/manage/user-notes.php