note 127321 added to function.pathinfo
| From: | dhanvee at main dot php dot net | Date: | Thu, 21 Jul 2022 18:32:02 +0000 |
| Subject: | note 127321 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219051@lists.php.net to get a copy of this message | ||
about the path, there are one thing you should note :
On Windows, both slash (/) and backslash (\) are used as directory separator character. In other
environments, it is the forward slash (/). (this explain is from basename() function part https://www.php.net/manual/en/function.basename.php)
example:
<?php
$path = "https://www.dhanveegupta.com
/a\b\c\filename.pdf";
echo pathinfo($pdfUrl, PATHINFO_BASENAME); //get basename
//output
//on window: result is filename.pdf
//on Linux: result is a\b\c\filename.pdf (that is may not your expect)
//so in order to get same result in different system. i will do below first.
$path = str_replace($path, '\\', '/'); //convert '\' to '/'
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 46.165.250.78)
----
Manual Page -- https://php.net/manual/en/function.pathinfo.php
Edit -- https://main.php.net/note/edit/127321
Del: integrated -- https://main.php.net/note/delete/127321/integrated
Del: useless -- https://main.php.net/note/delete/127321/useless
Del: bad code -- https://main.php.net/note/delete/127321/bad+code
Del: spam -- https://main.php.net/note/delete/127321/spam
Del: non-english -- https://main.php.net/note/delete/127321/non-english
Del: in docs -- https://main.php.net/note/delete/127321/in+docs
Del: other reasons-- https://main.php.net/note/delete/127321
Reject -- https://main.php.net/note/reject/127321
Search -- https://main.php.net/manage/user-notes.php