[PHP] Re: Array decleration problem

2007-01-03 Thread Al
There another error in your code in addition to the missing ";", echo() is for 
strings, not arrays.


Also, look up the use of single and double quotes in the php docs. It's a good 
habit to learn to use the right one early on.


Delta Storm wrote:

Hi,

I'm new to php and im learning, I haven't encounter any problems till 
now so please help me? :)


the code: (learning arrays...)


$flavors=array ("banana", "cucumber", "grape", "vanilla")


$flavors2 [0] =3;

$flavors2 [1]=13;

$fruits ["red"] = "system";

$fruits ["yellow"] = "server";
$fruits ["purple"] = "client";

echo $flavors;

echo "";
echo $flavors2;
echo "";
echo $fruits;

?>


I get an error message:
Parse error: parse error, unexpected T_VARIABLE in C:\Program 
Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16


I embedded the code into an html document so line 16 is line 6 
($flavors2[0]=3;)


I have no idea why is this error showing up i tried everything

Thank you in advance


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Array decleration problem

2007-01-03 Thread Jo�o C�ndido de Souza Neto
it happens because you forgot the semi-collon at the end of the previews 
line.

"Delta Storm" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Hi,
>
> I'm new to php and im learning, I haven't encounter any problems till now 
> so please help me? :)
>
> the code: (learning arrays...)
>
> 
> $flavors=array ("banana", "cucumber", "grape", "vanilla")
>
>
> $flavors2 [0] =3;
> $flavors2 [1]=13;
>
> $fruits ["red"] = "system";
> $fruits ["yellow"] = "server";
> $fruits ["purple"] = "client";
>
> echo $flavors;
> echo "";
> echo $flavors2;
> echo "";
> echo $fruits;
>
> ?>
>
> I get an error message:
> Parse error: parse error, unexpected T_VARIABLE in C:\Program 
> Files\XAMPP\xampp\htdocs\test_folder\exercise12.php on line 16
>
> I embedded the code into an html document so line 16 is line 6 
> ($flavors2[0]=3;)
>
> I have no idea why is this error showing up i tried everything
>
> Thank you in advance 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php