note 104203 added to function.basename

From: Date: Tue, 31 May 2011 20:25:34 +0000
Subject: note 104203 added to function.basename
Groups: php.notes 
Request: Send a blank email to php-notes+get-180143@lists.php.net to get a copy of this message
$info = pathinfo($file); $file_name = basename($file,'.'.$info['extension']); why would you use the basename if u already used pathinfo? the pathinfo function also returns the basename for you and also filename that is the filename without the extension well... since php 5.2.0.... anyway if ur using php above 5.2.0 u can use the filename index from the pathinfo return array i usualy do this: $fileInfo = (object) pathinfo($filename); ---- Server IP: 69.147.83.197 Probable Submitter: 201.23.85.186 ---- Manual Page -- http://www.php.net/manual/en/function.basename.php Edit -- https://master.php.net/note/edit/104203 Del: integrated -- https://master.php.net/note/delete/104203/integrated Del: useless -- https://master.php.net/note/delete/104203/useless Del: bad code -- https://master.php.net/note/delete/104203/bad+code Del: spam -- https://master.php.net/note/delete/104203/spam Del: non-english -- https://master.php.net/note/delete/104203/non-english Del: in docs -- https://master.php.net/note/delete/104203/in+docs Del: other reasons-- https://master.php.net/note/delete/104203 Reject -- https://master.php.net/note/reject/104203 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180143) next »