Re: stoping a while statement

From: Date: Wed, 10 Oct 2001 07:51:11 +0000
Subject: Re: stoping a while statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70595@lists.php.net to get a copy of this message
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. > ... > Why not to try 'foreach' instead of 'while'. Maybe it's a little simpler. :) <? $line = "www.northwesthost.com,dns1.northwesthost.com,dns2.northwesthost.com,www.tester.com"; $line = explode( ',', $line ); foreach ($line as $l) { if ($variable == $l) { print("<b> Domain $variable is already there</b><br>"); break; } } ?> -- Pavel a.k.a. Papi

« previous php.general (#70595) next »