"for" statements not working yet

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

"for" statements not working yet

Post 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;
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: "for" statements not working yet

Post by twinedev »

See http://www.php.net/manual/en/control-structures.for.php for how to use it and examples.

-Greg
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

Re: "for" statements not working yet

Post by Dannerz »

Thanks for the fast reply.
I tried one of the examples and it works.
I've got allot to learn.
Post Reply