RE: [PHP] elegant way of doing something else the last time through a loop? SOLVED

From: Date: Tue, 15 Jul 2003 14:47:22 +0000
Subject: RE: [PHP] elegant way of doing something else the last time through a loop? SOLVED
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155288@lists.php.net to get a copy of this message
Well, it should never be, it comes from a drop down that only has 3 options, any, all or exact Any caveats there? -----Original Message----- From: David Otton [mailto:djo@jawbone.freeserve.co.uk] Sent: Monday, July 14, 2003 2:58 PM To: Petre Agenbag Subject: Re: [PHP] elegant way of doing something else the last time through a loop? SOLVED On 14 Jul 2003 14:35:28 +0200, you wrote: >if ($_POST[any_all] == "any") { > $logic = "or"; >} >elseif ($_POST[any_all] == "all") { > $logic = "and"; >} >elseif ($_POST[any_all] == "exact") { > $logic = "exact"; >} [...] > if (!empty($temp)) $temp .= ' '.$logic.' '; Consider what would happen to $logic if $_POST['any_all'] was 'xyzzy'.

« previous php.general (#155288) next »