Jump to content

what is the *fastest* method to extract directory from url ?


madrazel

Recommended Posts

i guess without strrev and strstr,

 

this will work

 

<?php
#$subject = "http://www.server.com/dir/dir2/dir3/file.html";
$subject = "[email protected]";

$result = eregi_replace('(.*@).*', '\\1', $subject);
$result = eregi_replace('(.*\\/)(.*)[^\\/]+$', '\\1', $result);

echo "$result<br />";
?>

 

Please note i am still learning eregi so am use them when i can, so this was kinda pratice for me  :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.