title: What's the purpose of ini_set() in php? (especially for error reporting)
body: <p>Ok so PHP has the function <code>ini_set()</code> which a lot of people are aware of and will use to set various configuration options (<a href="http://php.net/manual/en/ini.list.php" rel="noreferrer">here</a>) to help with development etc. However, this function does only seem to work at runtime and will not work if there are any fatal errors or the script has syntax errors and can't be parsed / compiled.</p>
  
  <p>Therefore surely there is no point of doing this (from the manual):</p>
  
  <blockquote>
    <p><a href="http://php.net/manual/en/function.ini-set.php" rel="noreferrer">http://php.net/manual/en/function.ini-set.php</a></p>
    
    <p><strong>Examples</strong></p>
    
    <p>Example #1 Setting an ini option</p>
  </blockquote>
  
  <pre><code>&lt;?php
  echo ini_get('display_errors');
  
  if (!ini_get('display_errors')) {
      ini_set('display_errors', '1');
  }
  
  echo ini_get('display_errors');
  ?&gt;
  </code></pre>
  
  <p>I don't know if I'm just missing something and my php.ini isn't configured correctly, but a lot of the time I get no errors. For beginners / juniors there will no doubt be a lot of syntax errors (missing semi-colons, closing brackets etc), and said juniors would search for how to turn on errors, assume the above manual entry is correct, yet when re-running their script, alas, they get no errors as the script cannot be parsed / compiled in the first place.</p>
  
  <p>I know you can set <code>display_errors = On</code> in the php.ini file and restart your web server to show all errors to the screen (using this in a development environment, definitely not live), but wouldn't it be better just to remove the function and only configure the <em>php.ini</em> file for different error levels?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I know ini_set isn't just for displaying errors, but code can't be very manageable if you're calling ini_set in certain scripts / functions / files and wouldn't it make more sense to use the php.ini for something like that?</p>
  
  <p><strong>Update</strong></p>
  
  <p>So the ini file can be used to set global configuration options, surely you'd use this for security or optimisation, however developers could still use ini_set to override some of these options at runtime which may not be desirable</p>
  
  <p><strong>In summary</strong> (@Hanky웃Panky):</p>
  
  <p>Why do I have the option of displaying errors when some trivial syntax errors will still not display?</p>