Connect With Us

PHP Conditional Statements Lead to Swiss Cheese Syndrome

It hasn't even been a week since I posted last, and yet it feels like it has been several. The PHP I: Foundations class from Zend is challenging without being difficult, but the pace is fast. I'm certain it's my lack of programmer experience and not working in the field that makes it this way for me, but one PHP topic gets me lost and then the next one the light will come on for me, leaving a few holes here and there akin to a slice of Swiss cheese. "Mr. Instructor" ...


All registered users get access to premium content on iPro Developer for free.

Already registered? here.

Discuss this Blog Entry 2

on Oct 17, 2012
Hi Chris, Thank you! And yes, yes, and yes. I can't believe I STILL blew it. Well, I can. I'm learning writing code is just like writing an article, you can always find something to, um, improve :) Not only did I forget the $ symbol before the facecards variables within the nested or multidimensional array, but I also forgot another semicolon after the 4). Darn it! And yes, I need to learn to use single quotes when interpolation isn't necessary. That still has me a tad confused. I need to watch the recording of the class where we covered that topic (which I believe was on the first day in syntax). We also learned about the PATH_SEPARATOR constant with the DIRECTORY one :) Baby steps! Thanks again, I wouldn't have realized I made these errors if you didn't point them out! I so need more help with this. -Rita
on Oct 16, 2012
Nice blog. Shouldn't that be 'Red' => $facecards, etc. ? Needs the $ sign. When PHP encounters an undefined variable without the $, it treats it like a defined constant such as define('facecards','facecards'); and logs a warning. Please stop using "" when you don't need interpolation, use single quotes. It's faster. if ($dayOfWeek=='Friday') { PHP has a constant PATH_SEPARATOR too which is typically ':'. Chris Ringer

Please or Register to post comments.

What's The iPro Developer Blog Archive?

Blog entries from the past

Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×