note 61886 added to reserved.variables

From: Date: Tue, 14 Feb 2006 17:44:56 +0000
Subject: note 61886 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-103695@lists.php.net to get a copy of this message
Using a combination of magic and a few examples from below (thank you to those below), the following two functions should provide the script with a list (in order) of what is after the script. printvars.php: <?php function array_compress($array) { $aReturn = array(); foreach ($array as $value) if (strlen($value) > 0) { $aReturn[] = $value; } return $aReturn; } function getPathVariables() { $sPathPS = $_SERVER[PHP_SELF]; $sPathFS = __FILE__; $aPathPS = array_reverse(explode("/", $sPathPS)); $aPathFS = array_reverse(explode("/", $sPathFS)); $aReturn = array(); $x = 0; while ( $aPathPS[$x] != $aPathFS[$x] && $aPathPS[$x] != $aPathFS[0] ) { array_unshift($aReturn, $aPathPS[$x]) ; $x++; } return $aReturn; } print_r(array_compress(getPathVariables())); ?> ---- Calling: http://www.website.com/temp/printvars.php/or/whatever/something.jpg returns: Array ( [0] => or [1] => whatever [2] => something.jpg ) ---- Server IP: 216.194.113.175 Probable Submitter: 12.47.216.196 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61886 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61886&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61886&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103695) next »