note 116811 added to function.spl-autoload-register

From: Date: Tue, 03 Mar 2015 15:55:04 +0000
Subject: note 116811 added to function.spl-autoload-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-201848@lists.php.net to get a copy of this message
// Get last class version if( !function_exists('classAutoLoader') ) { function classAutoLoader($className) { $classFiles = array() ; $classFile = FALSE ; $classDir = __DIR__ .'/' ; // Get all files $files = scandir( $classDir ) ; foreach ( $files as $url ) { // Verifie if file is : Name + class + version + extension if( is_file($classDir.$url) && preg_match('/([^\.]+)\.class\.([\d\.]+)\.(.+)$/', $url, $m ) ) { // Verifie finded file if( $className == $m[1] ) { // Get previous version or init $previous = isset( $classFiles[$m[1]] ) ? $classFiles[$m[1]] : 0 ; // Get last version if( $previous<$m[2] ) { $classFiles[ $m[1] ] = $m[2] ; // version $classFile = $classDir.$url ; } } } } ; if( !class_exists($className) ) include( $classFile ); } } spl_autoload_register('classAutoLoader') ; ---- Server IP: 72.52.91.14 Probable Submitter: 78.197.52.15 ---- Manual Page -- http://php.net/manual/en/function.spl-autoload-register.php Edit -- https://master.php.net/note/edit/116811 Del: integrated -- https://master.php.net/note/delete/116811/integrated Del: useless -- https://master.php.net/note/delete/116811/useless Del: bad code -- https://master.php.net/note/delete/116811/bad+code Del: spam -- https://master.php.net/note/delete/116811/spam Del: non-english -- https://master.php.net/note/delete/116811/non-english Del: in docs -- https://master.php.net/note/delete/116811/in+docs Del: other reasons-- https://master.php.net/note/delete/116811 Reject -- https://master.php.net/note/reject/116811 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201848) next »