note 30623 modified in function.array by derick

From: Date: Thu, 17 Jun 2004 08:45:13 +0000
Subject: note 30623 modified in function.array by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71208@lists.php.net to get a copy of this message
It is not wrong to write in a file named foobar.php. <?php $foo = array(foo => "foo", bar =>"bar"); echo $foo[foo]."<br>\n"; ?> If you start that program in PHP 4.2., you get the warnings. Notice: Use of undefined constant foo, assumed 'foo' in foobar.php at line 2 Notice: Use of undefined constant bar, assumed 'bar' in foobar.php at line 2 Notice: Use of undefined constant foo, assumed 'foo' in foobar.php at line 3 foo If the entries of an associative array are strings, then you SHOULD quote them. Greetings, Wolke --was-- It is not wrong to write in a file named foobar.php. <?php $foo = array(foo => "foo", bar =>"bar"); echo $foo[foo]."<br>\n"; ?> If you start that program in PHP 4.2., you get the warnings. Notice: Use of undefined constant foo, assumed 'foo' in foobar.php at line 2 Notice: Use of undefined constant bar, assumed 'bar' in foobar.php at line 2 Notice: Use of undefined constant foo, assumed 'foo' in foobar.php at line 3 foo If the entries of an associative array are strings, then it is better to quote them. Greetings, Wolke http://php.net/manual/en/function.array.php

« previous php.notes (#71208) next »