note 54485 deleted from reserved.variables by cmb

From: Date: Tue, 05 Nov 2019 09:46:45 +0000
Subject: note 54485 deleted from reserved.variables by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212903@lists.php.net to get a copy of this message
Note Submitter: andy dot gajetzki at gmail dot com ---- I wanted to be able to embed a variable in the path. This is useful when, for example, images are rendered on the fly and you would like them to have different urls. Here is an illustration: www.somesite.com/image.php/IMAGETEXTHERE This would return an image with the text after "image.php/" contained in it. I could not recall the name of this feature, so I made a work-around in PHP... <? function getPathVariables() { $sPathPS = $_SERVER[PHP_SELF]; $sPathFS = __FILE__; $aPathPS = array_reverse(explode("/", $sPathPS)); $aPathFS = array_reverse(explode("/", $sPathFS)); $aImageArgs = array(); $x = 0; while ( $aPathPS[$x] != $aPathFS[$x] && $aPathPS[$x] != $aPathFS[0] ) { array_unshift($aImageArgs, $aPathPS[$x]) ; $x++; } return $aImageArgs; } ?> This function will return an array containing each "/" delimited portion of the path after the script name itself.

« previous php.notes (#212903) next »