Re: PARSE ERROR, unexpected T_$VARIABLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 06 Dec 2004 11:54:50 -0500, Robert Sossomon
<robert_sossomon@xxxxxxxx> wrote:
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> c:\fourh\leadership\registration_post.php on line 29
> 
> for ($i=0; $i < count($choices); $i++)

This is bad.  Every time the for() loop iterates, the count() function
gets called again unnecessarily.  Better to do:

$count = count( $choices );
for ($i=0; $i < $count; $i++)

> {
>   $value = $choices[$i];
>   $tempChoice = "choice" . $j;
>   $$tempChoice = $value;
>   $j++;
> }
> 
> $0405distoffice= $_POST['04_05_dist_office'];  //line29

Variables can contain numbers, but the first character after the $
must not be one.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux