note 75409 added to function.realpath
| From: | adyballaatklingbimdotde at osu1 dot php dot net | Date: | Mon, 28 May 2007 15:55:31 +0000 |
| Subject: | note 75409 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126982@lists.php.net to get a copy of this message | ||
I have also a short solution.
But Im not sure, if it is performant.
Explode-Array solution seems to work very fast.
function buildRelativePath($path){
$oldP = "";
$newP = $path;
while($newP!=$oldP){
$oldP = $newP;
$newP = preg_replace("/([^\/]+\/)([^\/]+\/)(\.\.\/)/ms","$1",$newP);
}
return str_replace("//","",str_replace("./","",$newP));
}
----
Server IP: 217.160.72.57
Probable Submitter: 84.58.245.161
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/75409
Del: integrated -- https://master.php.net/note/delete/75409/integrated
Del: useless -- https://master.php.net/note/delete/75409/useless
Del: bad code -- https://master.php.net/note/delete/75409/bad+code
Del: spam -- https://master.php.net/note/delete/75409/spam
Del: non-english -- https://master.php.net/note/delete/75409/non-english
Del: in docs -- https://master.php.net/note/delete/75409/in+docs
Del: other reasons-- https://master.php.net/note/delete/75409
Reject -- https://master.php.net/note/reject/75409
Search -- https://master.php.net/manage/user-notes.php