note 81935 added to function.realpath
| From: | 131 dot php at cloudyks dot org | Date: | Thu, 20 Mar 2008 01:34:06 +0000 |
| Subject: | note 81935 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137223@lists.php.net to get a copy of this message | ||
<?
//rp like, working with absolute/relative path & a little bit shorter :p
function rp($path) {
$out=array();
foreach(explode('/', $path) as $i=>$fold){
if ($fold=='' || $fold=='.') continue;
if ($fold=='..' && $i>0 && end($out)!='..')
array_pop($out);
else $out[]= $fold;
} return ($path{0}=='/'?'/':'').join('/', $out);
}
----
Server IP: 69.147.83.197
Probable Submitter: 82.66.98.222
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/81935
Del: integrated -- https://master.php.net/note/delete/81935/integrated
Del: useless -- https://master.php.net/note/delete/81935/useless
Del: bad code -- https://master.php.net/note/delete/81935/bad+code
Del: spam -- https://master.php.net/note/delete/81935/spam
Del: non-english -- https://master.php.net/note/delete/81935/non-english
Del: in docs -- https://master.php.net/note/delete/81935/in+docs
Del: other reasons-- https://master.php.net/note/delete/81935
Reject -- https://master.php.net/note/reject/81935
Search -- https://master.php.net/manage/user-notes.php