And if you have any E_NOTICE errors caused by other code between the set_error_handler and restore_error_handler they will not be dealt with properly.That means you can't assume you are dealing with an array, even if you used an expression such as isset($foo['aaaa']['bbb']['cc']['d']), because it will return true also if any part is a string. If $foo is a string, the index must actually be numeric (e.g. The following is an example of how to test if a variable is set, whether or not it is NULL.It makes use of the fact that an unset variable will throw an E_NOTICE error, but one initialized as NULL will not.A variable set to null is a different state than a variable not set - there should be some easy way to differentiate. Careful with this function "ifsetfor" by soapergem, passing by reference means that if, like the example $_GET['id'], the argument is an array index, it will be created in the original array (with a null value), thus causing posible trouble with the following code. For example: I tried the example posted previously by Slawek:$foo = 'a little string';echo isset($foo)? 'yes ':'no '; He got yes yes, but he didn't say what version of PHP he was using.I tried this on PHP 5.0.5 and got: yes no But on PHP 4.3.5 I got: yes yes Apparently, PHP4 converts the the string 'aaaa' to zero and then returns the string character at that position within the string $foo, when $foo is not an array.
is_null($var)) if they wanted to check for this!