A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Using E_ALL|E_STRICT a good practice?

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...
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>