note 38709 deleted from function.array by nlopess
| From: | nlopess@php.net | Date: | Sun, 04 Jan 2004 10:42:21 +0000 |
| Subject: | note 38709 deleted from function.array by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62887@lists.php.net to get a copy of this message | ||
Note Submitter: glassgorilla@NOSPAM.glassgorilla.net
----
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)