php - get the name of the current $_GET variable -


this question has answer here:

i want know url user has accessed. example, if user accessed:

index.php?register

it echo '1'.

if (isset($_get)) {     switch ($_get)     {         case "register":             echo 1;         break;     } } 

but doesn't anything, why? how name of first element?

$_get array. you'd need place switch statement inside foreach loop:

foreach ($_get $k => $v) {     switch ($k) {         case 'register':             echo 1;         break;     } } 

also, $_get superglobal always set – there's no need if (isset($_get)) {


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -