note 73144 deleted from function.pathinfo by nlopess

From: Date: Thu, 15 Feb 2007 13:06:30 +0000
Subject: note 73144 deleted from function.pathinfo by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123415@lists.php.net to get a copy of this message
Note Submitter: junk at plaino dot com ---- <?php // PHP compliant with pathinfo(): function path_parts($thePath) { // // Output: // // if $thePath = "/www/home/file.html"; // // $Aret['basename'] = file.html; // $Aret['extension'] = html; // $Aret['filename'] = file; // $Aret['dirname'] = /www/home; // $thePath = str_replace("\\", "/", $thePath); $filepathA = explode("/", $thePath); $filename = array_pop($filepathA); $filepathB = explode(".", $filename); $extension = array_pop($filepathB); $basename = implode(".", $filepathB); $basePath = join("/", $filepathA); $Aret = array(); $Aret['basename'] = $filename; $Aret['extension'] = $extension; $Aret['filename'] = $basename; $Aret['dirname'] = $basePath; return $Aret; } print "<pre>"; print_r (path_parts("/www/home/file.html")); print "</pre>"; ?>

« previous php.notes (#123415) next »