Posted by Dikkie Dik on 12/23/07 10:23
> function __autoload($class_name) {
> require_once $class_name . '.php';
> }
One nice thing to notice: an included file can return a value, which may
be an instance. So you could write a class in a file that looks like this:
class WhatEver
{
....
}
return new WhatEver();
And then call that dynamically:
$obj = require($pathToWhatEver);
I use this trick for my unit testing system.
[Back to original message]
|