Infinite loop with for(), sizeof()
| From: | Steve Chadsey | Date: | Mon, 24 Jul 2000 04:08:10 +0000 |
| Subject: | Infinite loop with for(), sizeof() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7816@lists.php.net to get a copy of this message | ||
Hello,
I'm wondering what I'm doing wrong here, with the following code:
---[start]-----
<?
$names[0] = "Hello World ";
for($i = 0;$i <= sizeof($names); $i++) {
print $i . "<br>\n";
$names[$i] = trim($names[$i]);
}
?>
---[end]-----
It runs until I stop it.
It does this with PHP/4.0.1pl2 on both a Solaris 2.6 box and a Linux
2.2.14 box, both with apache 1.3.12.
If no one else can reproduce this, then I'll feel really bad.
--
Steve Chadsey <schadsey@anathema.lightbridge.com>
Now playing: Time Is Coming
(Testament - "Practice What You Preach")