the statement if (!$foo && !$bar) { echo 'hi'; } is typed as if (!$foo && !bar) { echo 'hi'; } (with the '$bar' mistyped as 'bar') and i just found that PHP won't give error... is it true that the word bar is taken as a string literal... it seems a bit weird and sometimes it can give hard to catch error. many thanks.
ah i see... so with error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); it will say bar is undefined constant and will treat it as a string literal (like if i do a var_dump(bar); )
Someone suggested using error_reporting(E_ALL); I have some code to tell what E_ALL includes... if someone knows of better ways of doing it and like to share could you post here. thanks. $arrayErrorLevelName = array( 'E_ERROR', 'E_WARNING', 'E_PARSE', 'E_NOTICE', 'E_CORE_ERROR', 'E_CORE_WARNING', 'E_COMPILE_ERROR', 'E_COMPILE_WARNING', 'E_USER_ERROR', 'E_USER_WARNING', 'E_USER_NOTICE', 'E_STRICT', 'E_RECOVERABLE_ERROR', 'E_DEPRECATED', 'E_USER_DEPRECATED' ); echo "<pre>On PHP " . phpversion() . "\nE_ALL includes\n--------------\n"; foreach ($arrayErrorLevelName as $errorLevelName) { eval("if ($errorLevelName & E_ALL) echo(\"$errorLevelName\n\");"); } PHP: