<p>Typically I use <code>E_ALL</code> to see anything that PHP might say about my code to try and improve it.</p>

<p>I just noticed a error constant <code>E_STRICT</code>, but have never used or heard about it, is this a good setting to use for development? The manual says:</p>

<blockquote>
  <p>Run-time notices. Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. </p>
</blockquote>

<p>So I'm wondering if I'm using the best <code>error_reporting</code> level with <code>E_ALL</code> or would that along with <code>E_STRICT</code> be the best? Or is there any other combination I've yet to learn?</p>

[{'answer_id': 74864, 'author': 'Tim Boland', 'author_id': 70, 'author_profile': 'https://Stackoverflow.com/users/70', 'pm_score': -1, 'selected': False, 'text': '<p>ini_set("display_errors","2");\nERROR_REPORTING(E_ALL);</p>\n'}, {'answer_id': 74907, 'author': 'Daniel Papasian', 'author_id': 7548, 'author_profile': 'https://Stackoverflow.com/users/7548', 'pm_score': 3, 'selected': False, 'text': '<p>In my opinion, the higher you set the error reporting level in development phase, the better.  </p>\n\n<p>In a live environment, you want a slightly (but only slightly) reduced set, but you want them logged somewhere that they can\'t be seen by the user (I prefer <code>syslog</code>).</p>\n\n<p><a href="http://php.net/error_reporting" rel="nofollow noreferrer">http://php.net/error_reporting</a></p>\n\n<p><code>E_ALL | E_STRICT</code> for development with PHP before 5.2.0.</p>\n\n<p>5.2 introduces <code>E_RECOVERABLE_ERROR</code> and 5.3 introduces <code>E_DEPRECATED</code> and <code>E_USER_DEPRECATED</code>.  You\'ll probably want to turn those on if you\'re running one of those versions.</p>\n\n<p>If you wanted to use magic numbers you could just set the <code>error_reporting</code> value to some fairly high value of <code>2^n-1</code> - say, <code>16777215</code>, and that would really just turn on all the bits between <code>1..n</code>.  But I don\'t think using magic numbers is a good idea...</p>\n\n<p>In my opinion, PHP has dropped the ball a bit by having <code>E_ALL</code> not really be all.  But apparently it\'s going to be fixed in PHP 6...</p>\n'}, {'answer_id': 74923, 'author': 'Jim', 'author_id': 8427, 'author_profile': 'https://Stackoverflow.com/users/8427', 'pm_score': 6, 'selected': True, 'text': '<p>In PHP 5, the things covered by <code>E_STRICT</code> are not covered by <code>E_ALL</code>, so to get the most information, you need to combine them:</p>\n\n<pre><code> error_reporting(E_ALL | E_STRICT);\n</code></pre>\n\n<p>In PHP 5.4, <code>E_STRICT</code> will be included in <code>E_ALL</code>, so you can use just <code>E_ALL</code>.</p>\n\n<p>You can also use</p>\n\n<pre><code>error_reporting(-1);\n</code></pre>\n\n<p>which will always enable <em>all</em> errors. Which is more semantically correct as:</p>\n\n<pre><code>error_reporting(~0);\n</code></pre>\n'}, {'answer_id': 74924, 'author': 'Jan Krüger', 'author_id': 12471, 'author_profile': 'https://Stackoverflow.com/users/12471', 'pm_score': 2, 'selected': False, 'text': '<p>In newer PHP versions, E_ALL includes more classes of errors. Since PHP 5.3, E_ALL includes everything <em>except</em> E_STRICT. In PHP 6 it will alledgedly include even that. This is a good hint: it\'s better to see more error messages rather than less.</p>\n\n<p>What\'s included in E_ALL is documented in the <a href="http://uk.php.net/manual/en/errorfunc.constants.php" rel="nofollow noreferrer">PHP predefined constants</a> page in the online manual.</p>\n\n<p>Personally, I think it doesn\'t matter all that much if you use E_STRICT. It certainly won\'t hurt you, especially since it may prevent you from writing scripts that have a small chance of getting broken in future versions of PHP. On the other hand, in some cases strict messages may be too noisy, perhaps especially if you\'re in a hurry. I suggest that you turn it on by default and turn it off when it gets annoying.</p>\n'}, {'answer_id': 74963, 'author': 'stormlash', 'author_id': 12657, 'author_profile': 'https://Stackoverflow.com/users/12657', 'pm_score': 1, 'selected': False, 'text': '<p>Depending on your long term support plans for this code, debugging with <code>E_STRICT</code> enabled may help your code to continue working in the distant future, but it is probably overkill for day-to-day use.  There are two important things about <code>E_STRICT</code> to keep in mind:</p>\n\n<ol>\n<li><a href="http://us3.php.net/error_reporting" rel="nofollow noreferrer">Per the manual</a>, most <code>E_STRICT</code> errors are generated at compile time, not runtime.  If you are increasing the error level to <code>E_ALL</code> within your code (and not via <em>php.ini</em>), you may never see <code>E_STRICT</code> errors anyway.</li>\n<li><code>E_STRICT</code> is contained within <code>E_ALL</code> under PHP 6, but not under PHP 5.  If you upgrade your server to PHP6, and have <code>E_ALL</code> configured as described in #1 above, you will begin to see <code>E_STRICT</code> errors without requiring any additional changes on your part.</li>\n</ol>\n'}, {'answer_id': 75368, 'author': 'Pablo Borowicz', 'author_id': 13275, 'author_profile': 'https://Stackoverflow.com/users/13275', 'pm_score': 0, 'selected': False, 'text': '<p>Not strictly speaking of error_reporting, I\'d <strong>strongly</strong> suggest using any IDE that automatically shows parsing errors and common glitches (eg, assignment in condition).</p>\n\n<p>Zend Studio for Eclipse has this feature enabled by default, and since I started using it, it has been helping me <strong>a lot</strong> at catching errors before they occur.</p>\n\n<p>For example, I had this piece of code where I was caching some data in the <code>$GLOBALS</code> variable, but I inadvertently wrote <code>$_GLOBALS</code> instead. The data never got cached up, and I\'d never knew if Zend didn\'t tell me: "Hey, this <code>$_GLOBALS</code> thingy appears only once, that might be an error".</p>\n'}, {'answer_id': 75392, 'author': 'Eduardo Marinho', 'author_id': 13211, 'author_profile': 'https://Stackoverflow.com/users/13211', 'pm_score': 3, 'selected': False, 'text': '<p>Use the following in php.ini:</p>\n\n<pre><code>error_reporting = E_ALL | E_STRICT\n</code></pre>\n\n<p>Also you should install <a href="http://xdebug.org" rel="nofollow noreferrer" title="Xdebug">Xdebug</a>, it can highlight your errors in blinding bright colors and print useful detailed information. </p>\n\n<p>Never let any error or notice in your code, even if it\'s harmless.</p>\n'}, {'answer_id': 7227429, 'author': 'RiaD', 'author_id': 768110, 'author_profile': 'https://Stackoverflow.com/users/768110', 'pm_score': 2, 'selected': False, 'text': '<p>You may use <code>error_reporting = -1</code><br>\nIt will always consist of all bits (even if they are not in E_ALL)</p>\n'}]
['https://Stackoverflow.com/questions/74847', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5261/']