note 106597 added to function.realpath
| From: | spam at klickagent dot ch | Date: | Mon, 21 Nov 2011 16:42:40 +0000 |
| Subject: | note 106597 added to function.realpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184601@lists.php.net to get a copy of this message | ||
realpath() function for relative paths:
$relativePath = '../gallery/index/../../advent11/app/';
$pattern = '/\w+\/\.\.\//';
while(preg_match($pattern,$relativePath)){
$relativePath = preg_replace($pattern, '', $relativePath);
}
output: '../advent11/app/'
----
Server IP: 69.147.83.197
Probable Submitter: 188.60.200.67
----
Manual Page -- http://www.php.net/manual/en/function.realpath.php
Edit -- https://master.php.net/note/edit/106597
Del: integrated -- https://master.php.net/note/delete/106597/integrated
Del: useless -- https://master.php.net/note/delete/106597/useless
Del: bad code -- https://master.php.net/note/delete/106597/bad+code
Del: spam -- https://master.php.net/note/delete/106597/spam
Del: non-english -- https://master.php.net/note/delete/106597/non-english
Del: in docs -- https://master.php.net/note/delete/106597/in+docs
Del: other reasons-- https://master.php.net/note/delete/106597
Reject -- https://master.php.net/note/reject/106597
Search -- https://master.php.net/manage/user-notes.php