Skip to content

Instantly share code, notes, and snippets.

@jakiestfu
Created July 13, 2012 15:40
Show Gist options
  • Save jakiestfu/3105558 to your computer and use it in GitHub Desktop.
Save jakiestfu/3105558 to your computer and use it in GitHub Desktop.
pip.php
//if($request_url)...
// Save GET queries
$parsedUrl = parse_url(home_url($request_url));
if($parsedUrl['query']){
$queries = explode('&',$parsedUrl['query']);
foreach($queries as $query){
$queryInfo = explode('=',$query);
$_GET[$queryInfo[0]]=end($queryInfo);
}
}
// Split the url into segments
$segments = explode('/', $url);
for($i=0;$i<count($segments);$i++){
if(stripos($segments[$i], '?')!==false){
$segments[$i] = substr($segments[$i], 0, stripos($segments[$i], '?'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment