08-17-2008, 02:17 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Conditional doesn't trigger error, but doesn't work?
So in my effort to reduce using functions such as preg_match, I tried this little bit of code in a method today:
PHP Code:
if ($list_type != ('categories' || 'versions')) { trigger_error('Invalid list type', E_USER_NOTICE); return; }
This doesn't produce any errors or notices, but neither does it work as I hoped it would. How come? I'm using the following instead...
PHP Code:
if (! in_array($list_type, array('categories', 'versions'))) { trigger_error('Invalid list type', E_USER_NOTICE); return; }
...but you would think if PHP accepted the original as valid code, it would produce some kind of result.
-m
|
|
|
|