note 49379 rejected from language.types.array by cece

From: Date: Wed, 26 Jan 2005 09:37:46 +0000
Subject: note 49379 rejected from language.types.array by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84009@lists.php.net to get a copy of this message
Note Submitter: ---- Hi all Look at the code: <?php error_reporting(E_ALL); $a = array( "b" => array( "c" => "d" ) ); $e = $a['b']['c']['r']; echo "\$e = " . $e . "<br>\n"; $f = $a['x']['y']['z']; echo "\$f = " . $f . "<br>\n"; $g = $a['b']['c']; $gg = $g['r']; echo "\$g = " . $g . "<br>\n"; echo "\$gg = " . $gg . "<br>\n"; ?> Look at the result: $e = d Notice: Undefined index: x in D:\apache\Apache2\htdocs\shop\_test_rezygnacji.php on line 15 $f = $g = d $gg = d Now, please tell me: Why PHP returns notice for undefinex index 'x' for $f, but not for $e and not for $gg??? As you can see, PHP returns BAD VALUE "d" letter!!! for $e and for $gg (even if temporary variable $g is used). There is no error or warning!!!? Do the PHP check only first-level element in array for index in array? Why not second, third etc. ? Is this not an error in PHP? In my oppinion it is. Bad. Thx Sir_Fred

« previous php.notes (#84009) next »