PHP if statement explained with Robots and James Brown’s Sex Machine

George Ornbo over at ShapeShed (an EE shop, go admire the majesty) wrote a cute introduction to the PHP "if" statment. If you can't have fun with your code... well, then you just plain can't have fun.

I get a fair few requests from designers asking for help with basic PHP. So I'm going to write a series on very basic PHP. It is not hard so let's start with a robot and the if statement.

Not normally worthy of a mention, but he uses robots to explain, and everyone knows I'm a fool for robots; but also offers this masterful bit of PHP code (slightly altered, for brevity).

if ($button == "pressed"{
echo "I am alive and will now perform Sex Machine by James Brown";
else {
echo "Malfunction! Broken, destroyed, smashed.";

Why do I get the sense that this title is going to get me banned from Google?

This entry was made on and filed into How-To, PHP.


Jack McDade wrote on

LOL hilarious.

Steven W wrote on

Reminds me of when you were channeling Vanilla Ice for EE2.

I find that humor is the best way to learn, probably why i’m so fond of the “... for Dummies” series of books.

George wrote on

Hurrah for trans-atalantic robot appreciation! If I made your day you’ve made mine!

BoltClock wrote on

Here’s wishing they’ll spare you on account of… I don’t know.