note 104037 deleted from function.pathinfo by danbrown

From: Date: Wed, 18 May 2011 20:57:27 +0000
Subject: note 104037 deleted from function.pathinfo by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179864@lists.php.net to get a copy of this message
Note Submitter: webmaster[]arreay.ru ---- Функция "pathinfo" отказалась нормально показывать русские имена файлов написал альтернативу функции. 5000 вызовов за 0.3863 с. конечно не так быстро как pathinfo 0.0283 с. <?php function full_pathinfo ($path_file){ $path_file = strtr($path_file,array('\\'=>'/')); preg_match("~[^/]+$~",$path_file,$file); preg_match("~([^/]+)[.$]+(.*)~",$path_file,$file_ext); preg_match("~(.*)[/$]+~",$path_file,$dirname); return array('dirname' => $dirname[1], 'basename' => $file[0], 'extension' => (isset($file_ext[2]))?$file_ext[2]:false, 'filename' => (isset($file_ext[1]))?$file_ext[1]:$file[0]); } ?>

« previous php.notes (#179864) next »