php for loop

hi I was trying to loop for loop 5 times to echo 'hi all' 5 times. But i see output getting echoed only 1 time.

my code looks like

<?php

for($num=1; $num<=5; $num++);
{
echo "hi all"."<br/>";
}

?>

i was not sure what is the issue. Please advise on how to see echoed message 5 times

Open in new window

LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
You have  a trailing semi-colon on line 3. Remove that and it should work fine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
Some good learning resources for programmers new to PHP...
http://php.net/tut.php (read every page that is linked)
http://www.sitepoint.com/books/phpmysql4/ (worth every penny, and the time it takes to work through the exercises in the book)

Please make a Google search for "Zend Coding Standards" and learn why professional programmers indent their control structures.  Learn why we deliberately omit the close-php tag.  Learn why we use error_reporting(E_ALL).

Most importantly, please post back if you have any questions!  All the best, ~Ray
<?php
error_reporting(E_ALL);

for($num=1; $num<=5; $num++)
{
    echo "hi all THIS IS $num <br/>" . PHP_EOL;
}

Open in new window

0
Mohamed AbowardaSoftware EngineerCommented:
When you use "for", "if" or "while" statement you shouldn't use semi-colon at the end, the following code should work for you:

<?php

for($num=1; $num<=5; $num++)
{
echo "hi all"."<br/>";
}

?>

Open in new window

0
käµfm³d 👽Commented:
...and the award for not reading the prior comments before posting goes to...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.