List Info

Thread: note 76062 added to language.variables.predefined




note 76062 added to language.variables.predefined
user name
2007-06-28 09:05:56
theonly_DD32, I refined your function a little bit

<?php
	function long_to_GET($PATH_INFO=''){
		/**
		* This function converts info.php/a/1/b/2/c?d=4 TO
		* array ( [d] => 4 [a] => 1 [b] => 2 [c] =>
array ( [d] => 4 ) )
		* got this function from http://php.net/GLOBALS
		**/
		if($PATH_INFO=='' && isset($_SERVER['PATH_INFO'])
&& $_SERVER['PATH_INFO'] != ''){
			$PATH_INFO = $_SERVER['PATH_INFO'];
		}
		if($PATH_INFO != ''){
			//Split it out.
			$tmp = explode('/',$PATH_INFO);
			//Remove first empty item
			unset($tmp[0]);
			//Loop through and apend it into the $_GET superglobal.
			for($i=1;$i<=count($tmp);$i+=2){
				if(strpos($tmp[$i],'?')!==false){
					$tmp1 = explode('?',$tmp[$i]);
					parse_str(isset($tmp1[1])?$tmp1[1]:'',$_GET[$tmp1[0]]);

					$i--;
				} else {
					$_GET[$tmp[$i]] = isset($tmp[$i+1])?$tmp[$i+1]:'';
				}
			}
		}
	}

?>
----
Server IP: 69.147.83.197
Probable Submitter: 75.180.199.34
----
Manual Page -- http://www.php.net/manual/en/language.variables.pr
edefined.php
Edit        -- https://master
.php.net/note/edit/76062
Del: integrated  -- h
ttps://master.php.net/note/delete/76062/integrated
Del: useless     -- http
s://master.php.net/note/delete/76062/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/76062/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/76062/spam
Del: non-english -- 
https://master.php.net/note/delete/76062/non-english
Del: in docs     -- http
s://master.php.net/note/delete/76062/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/76062
Reject      -- https://mast
er.php.net/note/reject/76062
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )