Jump to content

[SOLVED] While Loop Gone Mad:P


AbydosGater

Recommended Posts

Hi Guys
Merry Xmas to you all!
Ive been trying to play with while loops, been some time since i have used them, and i needed to type out a list that went from 1, to 150 like 1,2,3..... so i came up with..

[code]<?php
$cnum = 1;
while ($cnum <= 150){
$num = $cnum++;
$cnum .= ",$num";
}
print $cnum;
?>[/code]
But when i run this its not stopping its putting big strain on my server, anyone see where i went wrong?

Thanks
-Andy
Link to comment
https://forums.phpfreaks.com/topic/31823-solved-while-loop-gone-madp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.