Logic and Control
摘要
Programs, even simple ones, will inevitably have to alter their behavior based on their inputs, or current state. Likewise, it’s usually necessary to perform operations repeatedly: imperative languages (programming languages that are composed of step-by-step instructions) such as PHP have features that allow for the testing of data and the concise expression of repetitive sequences of code. This chapter explores logical operations and control structures. Logic operations generate boolean values (true or false), and the control structures of PHP often use these boolean values to determine their behavior. In this way we can build programs that make runtime decisions and achieve a great deal of work with minimal code.