note 88718 added to function.pathinfo

From: Date: Wed, 04 Feb 2009 18:15:11 +0000
Subject: note 88718 added to function.pathinfo
Groups: php.notes 
Request: Send a blank email to php-notes+get-150210@lists.php.net to get a copy of this message
pathinfo() which can be used with UTF filenames. function pathinfo_utf($path) { if (strpos($path, '/') !== false) $basename = end(explode('/', $path)); elseif (strpos($path, '\\') !== false) $basename = end(explode('\\', $path)); else return false; if (empty($basename)) return false; $dirname = substr($path, 0, strlen($path) - strlen($basename) - 1); if (strpos($basename, '.') !== false) { $extension = end(explode('.', $path)); $filename = substr($basename, 0, strlen($basename) - strlen($extension) - 1); } else { $extension = ''; $filename = $basename; } return array ( 'dirname' => $dirname, 'basename' => $basename, 'extension' => $extension, 'filename' => $filename ); } ---- Server IP: 78.41.104.32 Probable Submitter: 194.186.91.5 ---- Manual Page -- http://www.php.net/manual/en/function.pathinfo.php Edit -- https://master.php.net/note/edit/88718 Del: integrated -- https://master.php.net/note/delete/88718/integrated Del: useless -- https://master.php.net/note/delete/88718/useless Del: bad code -- https://master.php.net/note/delete/88718/bad+code Del: spam -- https://master.php.net/note/delete/88718/spam Del: non-english -- https://master.php.net/note/delete/88718/non-english Del: in docs -- https://master.php.net/note/delete/88718/in+docs Del: other reasons-- https://master.php.net/note/delete/88718 Reject -- https://master.php.net/note/reject/88718 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150210) next »