note 19295 deleted from language.types.array by alindeman

From: Date: Fri, 22 Feb 2002 13:17:37 +0000
Subject: note 19295 deleted from language.types.array by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-26926@lists.php.net to get a copy of this message
There is a strange behavior of arrays within double quotes: error_reporting(E_ALL); $arr = array( 'foo' => 'bar', 'etc' => 'other'); //This will make a Parse Error in PHP 4.1.1: echo "Foo value is $arr['foo']"; //Try instead: echo "Foo value is ".$arr['foo']; //or echo "Foo value is {$arr['foo']}"; //This will work but WON'T send a warning as the doc says: echo "Foo value is $arr[foo]"; // THIS will work AND send the warning NOTICE: echo "Foo value is ".$arr[foo]; echo $arr[foo]; It seems you cannot use the correct syntax within ""s, try the deprecated one and it will work fine without nor even sending the warning... Should it work this way? Is it a bug? If yes, does it happens with 4.1.1 only ?? System: Slack 8.0 Linux 2.4.5 PHP 4.1.1 as a static module of Apache 1.3.22 João Paulo M. Fischer

« previous php.notes (#26926) next »