RE: [PHP] stoping a while statement
| From: | Philip Olson | Date: | Wed, 10 Oct 2001 08:07:56 +0000 |
| Subject: | RE: [PHP] stoping a while statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70601@lists.php.net to get a copy of this message | ||
That's what's so great about programming, there are a million ways to do
everything. The following will also work :
if (stristr($i,$variable)) {
echo "Woohoo! $variable was found within $i";
}
regards,
Philip Olson
On Wed, 10 Oct 2001, Andrew Braund wrote:
> How about;
>
> $variable="www.tester.com";
> $i="www.northwesthost.com,dns1.northwesthost.com,
> dns2.northwesthost.com,www.tester.com";
>
> $domains = explode(",",$i);
> if( in_array($variable, $domains) ){
> print("<b> Domain $variable is already there</b><br>");
> }
>
>
> > > > -----Original Message-----
> > > > From: Richard Kurth [mailto:rkurth@pacifier.com]
> > > > Sent: mercoledi 10 ottobre 2001 9.24
> > > > To: Richard Kurth
> > > > Subject: [PHP] stoping a while statement
> > > >
> > > >
> > > >
> > > > What do I need in the While statement so it will stop when it gets
> > > > to the end of the $i variable.
> > > >
> > > >
> > > >
> > > > $variable="www.tester.com";
> > > > $i="www.northwesthost.com,dns1.northwesthost.com,dns2.northwes
> > > > thost.com,www.tester.com";
> > > >
> > > > $count = 0;
> > > > while($i ==true) { <--what do I need hear so it will stop
> > > > $line_text =$i;
> > > > $strings = explode(",", $line_text);
> > > > if ($variable == trim($strings[$count])) {
> > > > print("<b> Domain $variable is already
> > > > there</b><br>");
> > > > break;
> > > > }
> > > > ++$count;
> > > > }
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>