IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Php For


Tom743
no avatar
Newbie
*
Group: Members
Posts: 6
Joined: 12-January 08
Member No.: 56,132



Post #1 post May 18 2008, 12:41 PM
Ive got this small php script that makes the numbers count up.

CODE
<?php
for($num = 1; $num <= 10; $num++) {
echo "Number: $num<br>";
}
?>


Is there any way it can be changed so that the numbers count down?

Thanks
Go to the top of the page
+Quote Post
rvalkass
no avatar
apt-get moo
Group Icon
Group: [MODERATOR]
Posts: 2,258
Joined: 28-May 05
From: Devon, England
Member No.: 7,593
Spam Patrol
myCENT:66.37



Post #2 post May 18 2008, 02:35 PM
Change ++ to -- and switch the numbers round:

CODE
<?php
for($num = 10; $num >= 1; $num--) {
echo "Number: $num<br>";
}
?>
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 5th December 2008 - 07:53 AM