06-04-2008, 05:28 PM
|
#1 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 335
Thanks: 2
|
Speed vs Ease of use
I have a tad of a problem, well not a problem more of a fork at the roads and I'd like all yours opinion.
The issue at hand is whether to use __autoload to semi handle my framework or use my own construct function which looks like this
PHP Code:
public function __construct($aClassReject = array()){
$inc = get_included_files();
$dir = str_replace('\\','/',dirname(__FILE__));
for($i = 0;$i <= count($inc);++$i){
if(strstr($inc[$i],'.class.php') and !strstr($inc[$i],'core.class.php')){
$className = str_replace(array($dir.'/','.class.php'),'',str_replace('\\','/',$inc[$i]));
if(!in_array($className,$aClassReject)){
$this->classArray[$className] = (is_array($aClassReject[$className])) ?
new $className($aClassReject[$className]) :
new $className;
}
}
unset($className);
}
//now that all classes are activated...check for their dependancies if any
foreach($this->classArray as $key => $val){
$this->__fetchDep($key);
}
}
The issue is with __autoload I'd need to activate the classes first where as with the above function I just include the files.
I hope I'm making sense, I'm just kinda wondering what choice would be the best to go with.
|
|
|
|