Re[4]: [PHP] Displaying one of three functions.
| From: | Martin Hudec | Date: | Mon, 28 Oct 2002 15:39:02 +0000 |
| Subject: | Re[4]: [PHP] Displaying one of three functions. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121727@lists.php.net to get a copy of this message | ||
Hello @ Edwin,
of course you can but let me say something
if .. else is used when u
need to execute one thing in case that requirement in if is met and
second thing if it is not met...
in case of if...elsif : command behind elsif is executed when
requirement in if is not met....you can add as many elsif as you
want...also u can end whole thing with else which is executed in case
when no previous requirements are met...
hope I wrote it good....sorry im too tired to think about english
grammar and such things ;)))
--
Best regards,
Martin mailto:corwin@corwin.sk
Monday, October 28, 2002, 4:18:45 PM, you wrote:
E> Hello,
E> "Martin Hudec" <corwin@corwin.sk> wrote:
>> or (from my point of view is this better)
>>
>> if {$country!="finland") :
>> display_shipping(calculate_nonfinland_cost($country));
>> elsif ($country=="finland" && $express=="no") :
>> display_shipping(calculate_shipping_cost($weight));
>> elseif ($country=="finland" && $express=="yes") :
>> display_shipping(calculate_express_cost($express));
>> endif;
>>
E> How about something like this?
E> if ($country!="finland"){
E> display_shipping(calculate_nonfinland_cost($country));
E> }else{ // if it's not "finland" it should be something else, no?
E> if ($express=="no"){
E> display_shipping(calculate_shipping_cost($weight));
E> }else{ // if it's not "no" it should be "yes", no?
E> display_shipping(calculate_express_cost($express));
E> }
E> }
E> Just an idea...
E> - E