I have been using Zend Framework for a few months now, and I really find the E_ALL|E_STRICT set in the bootstrap file really neat. See sample code below:
error_reporting(E_ALL|E_STRICT);echo $var; //display an unset variable. A notice will appear. //using an unset variable inside an if()-condition will also display the notice message //i use this kind of checking all the time, but i think it would be better to use //isset() since E_ALL|E_STRICT makes your code "cleaner" if ($var) { echo $var; } //we can avoid this if we use isset() if(isset($var)) { echo $var; } //so before using a variable, i would set it to '' on the top part of my code $var = ''; echo $var; //no notice message will be displayed. |
So, I can no longer use variable on the fly. I have to set it somewhere on top of my code and set it to something. Putting a comment beside it really helps too.
$str1 = ''; //Street Address $str2 = ''; //Building Number $str3 = ''; //Country ...the rest of my code... |