Page 1 of 1

"for" statements not working yet

Posted: Tue Aug 09, 2011 6:50 pm
by Dannerz
This is my code:

Code: Select all

for(5)
  {
  $first_numb+=1;
  return $first_numb;
  }
echo $first_numb . " first_numb has had 1 added 5 times.";
I'm not sure what's wrong.
I want it to execute the code between the brackets 5 times then after that echo the $first_numb;

Re: "for" statements not working yet

Posted: Tue Aug 09, 2011 7:03 pm
by twinedev
See http://www.php.net/manual/en/control-structures.for.php for how to use it and examples.

-Greg

Re: "for" statements not working yet

Posted: Tue Aug 09, 2011 7:19 pm
by Dannerz
Thanks for the fast reply.
I tried one of the examples and it works.
I've got allot to learn.