note 73227 added to function.pathinfo
| From: | corySPAM at lavacube dot com | Date: | Wed, 14 Feb 2007 03:31:18 +0000 |
| Subject: | note 73227 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123347@lists.php.net to get a copy of this message | ||
Oh shoot... not sure what I was thinking there.
Mods, please remove my last post.
Here is the function:
<?php
function path_info( $path )
{
preg_match('/^(.*)\/(.*)[\.](.*)$/', str_replace('\\', '/', $path),
$matches);
return array( 'dirname' => $matches[1],
'basename' => ($matches[3]?$matches[2].'.'.$matches[3]:$matches[2]),
'extension' => ($matches[3]?$matches[3]:null),
'filename' => $matches[2] );
}
?>
I'm not the greatest at regular expressions. If I am doing anything wrong, please let me know!
Thanks, and enjoy!
----
Server IP: 216.235.15.211
Probable Submitter: 142.165.95.174
----
Manual Page -- http://www.php.net/manual/en/function.pathinfo.php
Edit -- https://master.php.net/note/edit/73227
Del: integrated -- https://master.php.net/note/delete/73227/integrated
Del: useless -- https://master.php.net/note/delete/73227/useless
Del: bad code -- https://master.php.net/note/delete/73227/bad+code
Del: spam -- https://master.php.net/note/delete/73227/spam
Del: non-english -- https://master.php.net/note/delete/73227/non-english
Del: in docs -- https://master.php.net/note/delete/73227/in+docs
Del: other reasons-- https://master.php.net/note/delete/73227
Reject -- https://master.php.net/note/reject/73227
Search -- https://master.php.net/manage/user-notes.php