if else while statement speed
| From: | Dan Anderson | Date: | Wed, 03 Sep 2003 17:25:26 +0000 |
| Subject: | if else while statement speed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161572@lists.php.net to get a copy of this message | ||
I have a function where I have:
<?php
while (something())
{
if ($option1)
{ do_1(); }
elseif ($option2)
{ do_2(); }
// ... continue for 10 or more options...
}
?>
would it be quicker to do the above code or:
if ($option1)
{
while(something())
{ do_1(); }
}
elseif ($option2)
{
while (something())
{ do_2(); }
}
// ... continue for 10 or more options...
Thanks,
Dan