Redhead has you covered there, but I'll be a syntax nazi for a bit..
- It's always good practice to put your literal first in a comparison to avoid this very scenario.
eg:
PHP Code:
if ('0000-00-00' = $shipdate) {
$shipdate = 'NONE';
}
So even if you use = instead of == it'll evaluate as false and you'll find the problem earlier. Plus, if you have a large conditional statement, your literal will be in at the front and easier to read.
- One-liners are never good for code maintainability.
Not very clear:
PHP Code:
if ('0000-00-00' == $shipdate)
$shipdate = 'NONE';
func1();
func2();
//etc..
much better:
PHP Code:
if ('0000-00-00' == $shipdate) {
$shipdate = 'NONE';
}
func1();
func2();
//etc..
-r