What does $_GET['key'] return if the key is not set? What does $_GET['key'] return if the key is not set? arrays arrays

What does $_GET['key'] return if the key is not set?


$_GET is just an ordinary array, so it behaves exactly the same as any other array.

This means, it will return NULL to the variable and raise the "undefined index" notice when you call a non-existing index.

The only thing you need to be aware of with $_GET is that is contains unsafe (user-modifiable) data


Unset indexes have the value NULL. Accessing them will result in a notice being raised (unless your error level is set to swallow notices).