note 82302 added to language.operators.comparison

From: Date: Fri, 04 Apr 2008 17:13:05 +0000
Subject: note 82302 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-137934@lists.php.net to get a copy of this message
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 ---- Server IP: 69.147.83.197 Probable Submitter: 200.62.142.194 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/82302 Del: integrated -- https://master.php.net/note/delete/82302/integrated Del: useless -- https://master.php.net/note/delete/82302/useless Del: bad code -- https://master.php.net/note/delete/82302/bad+code Del: spam -- https://master.php.net/note/delete/82302/spam Del: non-english -- https://master.php.net/note/delete/82302/non-english Del: in docs -- https://master.php.net/note/delete/82302/in+docs Del: other reasons-- https://master.php.net/note/delete/82302 Reject -- https://master.php.net/note/reject/82302 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137934) next »