Re: Parse error: syntax error, unexpected ',' in

From: Date: Wed, 24 May 2006 06:25:16 +0000
Subject: Re: Parse error: syntax error, unexpected ',' in
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236807@lists.php.net to get a copy of this message
Mark Sargent wrote:
Hi All, this code, <?php $flavour[] = "blue raspberry"; $flavour[] = "root beer"; $flavour[] = "pineapple"; sort($flavour); print_r($flavour); echo "<br>"; echo "My favourite flavours are:<br>";
    foreach ($flavour as $currentValue) {
       //these lines will execute as long as there is a value in $flavour
       echo $currentValue "<br>\n";
    }
?> gives this, *Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18 * and adding a , to this line,
      foreach ($flavour, as $currentValue) {
gives this error, *Parse error*: syntax error, unexpected ',' in */usr/local/apache2/htdocs/sorting.php* on line *16*
Since there aren't actually 18 lines this isn't the real code.. The problem is here: echo $currentValue "<br>\n"; it should be echo $currentValue . "<br>\n"; or echo $currentValue , "<br>\n"; -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#236807) next »