01-05-2016, 02:59 PM
Although there is no limit to the number of if... else decisions you can chain together, both PHP and ActionScript offer an alternative approach through the use of switch statements. This method is more efficient when a large number of alternatives are involved, because thecondition is tested only once, whereas it’s tested each time in an elseif statement. switch statements are also often easier to read. The PHP script for the multiconverter you’ll build in this chapter (yes, you’re nearly there) handles more than 20 choices, so it’s an ideal candidate for switch.