note 86477 added to language.oop5.autoload

From: Date: Tue, 21 Oct 2008 19:45:22 +0000
Subject: note 86477 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-145543@lists.php.net to get a copy of this message
Building on Chris Continanza's function, I wanted to add in multiple filename options since sometimes I add ".class.php" and other times ".php". <? function __autoload($class_name) { $include_path = get_include_path(); $include_path_tokens = explode(':', $include_path); foreach($include_path_tokens as $prefix){ $path[0] = $prefix . '/' . $class_name . '.php'; $path[1]= $prefix . '/' . $class_name . '.class.php'; foreach($path as $thisPath){ if(file_exists($thisPath)){ require_once $thisPath; return; } } } } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 130.207.66.123 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- https://master.php.net/note/edit/86477 Del: integrated -- https://master.php.net/note/delete/86477/integrated Del: useless -- https://master.php.net/note/delete/86477/useless Del: bad code -- https://master.php.net/note/delete/86477/bad+code Del: spam -- https://master.php.net/note/delete/86477/spam Del: non-english -- https://master.php.net/note/delete/86477/non-english Del: in docs -- https://master.php.net/note/delete/86477/in+docs Del: other reasons-- https://master.php.net/note/delete/86477 Reject -- https://master.php.net/note/reject/86477 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145543) next »