note 82302 deleted from language.operators.comparison by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 06:42:37 +0000 |
| Subject: | note 82302 deleted from language.operators.comparison by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196605@lists.php.net to get a copy of this message | ||
Note Submitter: jescribens at urbangolem dot com
----
Hi all:
I found this and maybe it can help you, i didn't found it documented anywhere :
Assuming you have a function that returns an array or a null value in failure and you do something
like this
<?php
function myfunction()
{
if($something==$other)
{
return array(0=>array(0=>array('valor'=>$other)));
}else{
return null;
}
}
$x = myfunction();
var_dump($x); //can be null
if($x[0][0]['value'] < 1)
{
echo "nok";
}else{
echo "ok";
}
?>
If the function returns null then you get "nok" printed.
As far as I see NULL values are always less than 1, and the fact that I request a sub array
([0][0]['value']) doesn't give me any notice nor warning.
Hope this helps anybody.
Greetings