Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable name in a for statement...

Status
Not open for further replies.

dongbamage

Programmer
Nov 3, 2004
32
GB
hey guys is it valid to use a variable name in a for statement like so:

for ($i=0;$i<=$counter;i++)
{
echo yeehaa;
}

I'm getting Parse error: parse error, unexpected T_INC, expecting ')'
 


[tt]i++[/tt]

should be

[tt][red]$[/red]i++[/tt]

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
also:
echo yeehaa;

should be:
echo "yeehaa";

* capsulate the strings in quotes ("").
* variables start with $.

Did you also specify a value for $counter?

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top