note 78198 added to language.oop5.autoload

From: Date: Tue, 02 Oct 2007 21:53:12 +0000
Subject: note 78198 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-130995@lists.php.net to get a copy of this message
Is it secure to do things this way: <? function __autoload($class_name) { switch($class_name) { case 'class1': include('path\class1.php'); break; case 'class2': include('path\class2.php'); break; case 'class3': include('path\class1.php'); break; } } ?> and are there any benefits in using it in an array: <? $classes = array( 'class1' => 'path\class1.php'; 'class2' => 'path\class2.php'; 'class3' => 'path\class3.php'; ); function __autoload($class_name) { global $classes; if(isset($classes[$class_name])) { include($classes[$class_name]); } } ?> What about the performace issues/benefits using this type for including many files than including them one by one (hard coded)? http://www.lanix.org/ica/ ---- Server IP: 195.149.248.161 Probable Submitter: 88.80.140.163 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- https://master.php.net/note/edit/78198 Del: integrated -- https://master.php.net/note/delete/78198/integrated Del: useless -- https://master.php.net/note/delete/78198/useless Del: bad code -- https://master.php.net/note/delete/78198/bad+code Del: spam -- https://master.php.net/note/delete/78198/spam Del: non-english -- https://master.php.net/note/delete/78198/non-english Del: in docs -- https://master.php.net/note/delete/78198/in+docs Del: other reasons-- https://master.php.net/note/delete/78198 Reject -- https://master.php.net/note/reject/78198 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130995) next »