HomePHP Page 5 - PHP Statements and Beginning Loops
Here We Go Loop de Loop - PHP
We discussed statements briefly in our last article and even got a sneak peek of an IF-statement. Sure I mean, the image was blurry, and the moment it saw us it ran off into the forest. But we saw it. Honest. So in this article, we're going to take a much closer look at PHP statements and even start learning about loops.
You ever have one of those jobs where you do the same thing over and over all day, every day? Sure you have. Take the job of hamburger flipper. Before becoming the web's writer extraordinaire, I once worked at a burger restaurant. They sat me through orientation and gave me a giant book to study (which I never did; it was burger flipping, not rocket science). Then they told me my title and I was baffled: Top Bun Operator. Again: Top Bun Operator. No kidding. One guy "operated" the top bun and was responsible for its toppings, while a second guy was the Bottom Bun Operator. Apparently doing the whole bun was much too complicated.
One day, though , I became the Neo of the hamburger world. I was operating not only the top bun and the bottom bun, but the hot dog bun as well. All around me employees were betting their $5.25 an hour salaries and yelling "He's a madman!"
After that I quit, because let's face it: I had taken the job as far as it could go.
Can you imagine the poor dunce that gets reprimanded for not knowing how many pickle slices go on the top bun?
Anyway. Loops in PHP (and other programming languages) make the computer do repetitive tasks for you. I mean, that is what computing is all about. The are several types of loops, starting with the For Loop.