note 30623 added to function.array
| From: | wolke74 at web dot de | Date: | Mon, 24 Mar 2003 08:58:55 +0000 |
| Subject: | note 30623 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45720@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 it is better to quote them.
Greetings,
Wolke
--
http://www.php.net/manual/en/function.array.php
http://master.php.net/manage/user-notes.php?action=edit+30623
http://master.php.net/manage/user-notes.php?action=delete+30623
http://master.php.net/manage/user-notes.php?action=reject+30623