Re[2]: [PHP] stoping a while statement

From: Date: Wed, 10 Oct 2001 07:54:13 +0000
Subject: Re[2]: [PHP] stoping a while statement
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-70599@lists.php.net to get a copy of this message
Hello Pavel, Wednesday, October 10, 2001, 12:51:11 AM, you wrote: Pavel Jartsev> Richard Kurth wrote: >> >> What do I need in the While statement so it will stop when it gets >> to the end of the $i variable. >> ... >> Pavel Jartsev> Why not to try 'foreach' instead of 'while'. Maybe it's a little Pavel Jartsev> simpler. :) Pavel Jartsev> <? Pavel Jartsev> $line = Pavel Jartsev> "www.northwesthost.com,dns1.northwesthost.com,dns2.northwesthost.com,www.tester.com"; Pavel Jartsev> $line = explode( ',', $line ); Pavel Jartsev> foreach ($line as $l) { Pavel Jartsev> if ($variable == $l) { Pavel Jartsev> print("<b> Domain $variable is already there</b><br>"); Pavel Jartsev> break; Pavel Jartsev> } Pavel Jartsev> } ?>> Thanks that is exactly what I needed -- Best regards, Richard mailto:rkurth@pacifier.com

« previous php.general (#70599) next »