note 38709 added to function.array
| From: | glassgorilla at NOSPAM dot glassgorilla dot net | Date: | Sun, 04 Jan 2004 04:23:14 +0000 |
| Subject: | note 38709 added to function.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62885@lists.php.net to get a copy of this message | ||
This may be obvious to most, but when I worked with arrays for the first time, I was getting a parse
error because of the first example. I thought that arrays defined on multiple lines didn't need
to have the semicolon at the end of the statement (as example one has no semicolon). Well, they do
need it.
i.e. ->
<?php
$fruits = array (
"fruits" => array("a" => "orange", "b" =>
"banana", "c" => "apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
)
?>
should be
<?php
$fruits = array (
"fruits" => array("a" => "orange", "b" =>
"banana", "c" => "apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
?>
(Notice the semicolon after the final parentheses)
----
Manual Page -- http://www.php.net/manual/en/function.array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38709
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38709&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38709&report=yes
Search -- http://master.php.net/manage/user-notes.php