Reply to Re: 2 dumb questions

Your name:

Reply:


Posted by Paul Furman on 03/03/07 06:40

Kimmo Laine wrote:

> Paul Furman kirjoitti:
>
>> First, I'm sure the following code is not using an efficient structure
>> for the nested if then else's but I can't recall the right way:
>>
>
> With the help of our friend "else if" you get a really clean code:
>
> if ($item_qty > 19) {
> $price = ($price * .925);
> $qty_discount = '20 @ 7.5%';
> } else if ($item_qty > 9) {
> $price = ($price * .95);
> $qty_discount = '10 @ 5%';
> } else if ($item_qty > 4) {
> $price = ($price * .975);
> $qty_discount = '5 @ 2.5%';
> }

Thanks, that's better.
I should know this stuff...

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация