Skip to content

Instantly share code, notes, and snippets.

@ABooooo
Created August 19, 2014 07:23
Show Gist options
  • Save ABooooo/c685783c6ca838cf6709 to your computer and use it in GitHub Desktop.
Save ABooooo/c685783c6ca838cf6709 to your computer and use it in GitHub Desktop.
Read URL and create array after slash
<?php
$str = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$res = array_filter(explode("/", $str));
//echo $res[0];
if ($res[0] == "condition") {
// do something
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment