note 63312 added to language.variables.predefined
| From: | DD32=theonly_DD32 | Date: | Sun, 19 Mar 2006 13:43:29 +0000 |
| Subject: | note 63312 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106076@lists.php.net to get a copy of this message | ||
I have this function in my main files, it allows for easier SEO for some pages without having to
rely on .htaccess and mod_rewrite for some things.
<?php
function long_to_GET(){
/**
* This function converts info.php/a/1/b/2/c?d=4 TO
* Array ( [d] => 4 [a] => 1 [b] => 2 [c] => )
**/
if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] !=
''){
//Split it out.
$tmp = explode('/',$_SERVER['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){ $_GET[$tmp[$i]] = $tmp[$i+1];}
}
}
?>
Its probably not the most efficient, but it does the job rather nicely.
DD32
----
Server IP: 203.16.234.20
Probable Submitter: 210.10.143.196
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.variables.predefined.php
Edit -- http://master.php.net/note/edit/63312
Del: integrated -- http://master.php.net/note/delete/63312/integrated
Del: useless -- http://master.php.net/note/delete/63312/useless
Del: bad code -- http://master.php.net/note/delete/63312/bad+code
Del: spam -- http://master.php.net/note/delete/63312/spam
Del: non-english -- http://master.php.net/note/delete/63312/non-english
Del: in docs -- http://master.php.net/note/delete/63312/in+docs
Del: other reasons-- http://master.php.net/note/delete/63312
Reject -- http://master.php.net/note/reject/63312
Search -- http://master.php.net/manage/user-notes.php