Let me try this angle: if $_GET is method request detect (get/post/delete..etc) or does it specifically handle these sort of requests/queries? Maybe I'm not understanding $_GET's ultimate purpose?
It is purely a matter of personal preference, although actions are usually put in the url because it is visible to the user. I could write an application that transmits solely using post, but it limits the usability of the site because the user wouldn't know what they are at/doing.
I'm totally lost on the for each, what is $value for? I see nothing referring to it.
Its just so you can get the key of the array element, otherwise you would only get the value. It is identical to doing the following, except for some reason if you needed the value it wouldn't exist anymore.
Code: Select all
foreach (array_keys($_GET) as $key)
{
switch ($key)
{
case 'audio' : break;
case 'someothervar' : break;
default:
echo 'if it got here, some var was set that shouldn\'t exist';
}
}
The code you posted is always returning true (always reports an error).
I forgot to add the breaks in there. See above.