note 23860 deleted from language.types.array by tomsommer

From: Date: Sat, 03 Jul 2004 13:26:12 +0000
Subject: note 23860 deleted from language.types.array by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72426@lists.php.net to get a copy of this message
Note Submitter: slava@nospam.trushkin.net ---- When using array inside double-quoted string key should be single-quoted only if you use curly braces around variable like this: $array = array('key' => 'value'); incorrect syntax: echo "value = $array['key'] \n"; echo "value = {$array[key]} \n"; first line compiler won't even compile on second line compiler will consider "key" as contant and will show warning if error_reporting is E_ALL correct syntax: echo "value = $array[key] \n"; echo "value = {$array['key']} \n"; on first line: no curly braces - no quotes second line: use curly braces - should use quotes

« previous php.notes (#72426) next »