note 94462 added to function.dirname
| From: | remco at somewhereInHolland dot nl | Date: | Fri, 06 Nov 2009 14:35:05 +0000 |
| Subject: | note 94462 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162445@lists.php.net to get a copy of this message | ||
//Please be aware of the following:
$dir = dirname ('test/testing/test123/');
$file = basename('test/testing/test123/');
//will produce:
$dir = 'test/testing';
$file = 'test123';
//instead of:
$dir = 'test/testing/test123';
$file = '';
//you can add a "." to the location and remove it at the end of the file:
$location = 'test/testing/test123/' . '.';
$dir = dirname ($location);
$file = substr(basename($location),0,-1);
//will produce:
$dir = 'test/testing/test123';
$file = '';
$location = 'test/testing/test123/test.php' . '.';
$dir = dirname ($location);
$file = substr(basename($location),0,-1);
//will produce:
$dir = 'test/testing/test123';
$file = 'test.php';
----
Server IP: 83.137.20.135
Probable Submitter: 92.70.188.98
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- https://master.php.net/note/edit/94462
Del: integrated -- https://master.php.net/note/delete/94462/integrated
Del: useless -- https://master.php.net/note/delete/94462/useless
Del: bad code -- https://master.php.net/note/delete/94462/bad+code
Del: spam -- https://master.php.net/note/delete/94462/spam
Del: non-english -- https://master.php.net/note/delete/94462/non-english
Del: in docs -- https://master.php.net/note/delete/94462/in+docs
Del: other reasons-- https://master.php.net/note/delete/94462
Reject -- https://master.php.net/note/reject/94462
Search -- https://master.php.net/manage/user-notes.php