title: Is it necessary to declare PHP array before adding values with []?
body: <pre><code>$arr = array(); // is this line needed?
  $arr[] = 5;
  </code></pre>
  
  <p>I know it works without the first line, but it's often included in practice. </p>
  
  <p>What is the reason? Is it unsafe without it?</p>
  
  <p>I know you can also do this:</p>
  
  <pre><code> $arr = array(5);
  </code></pre>
  
  <p>but I'm talking about cases where you need to add items one by one.</p>