note 94462 deleted from function.dirname by danbrown
| From: | danbrown@php.net | Date: | Fri, 06 Nov 2009 14:58:41 +0000 |
| Subject: | note 94462 deleted from function.dirname by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162448@lists.php.net to get a copy of this message | ||
Note Submitter: remco at somewhereInHolland dot nl
----
//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';