title: How to add elements to an empty array in PHP?
body: <p>If I define an array in PHP such as (I don't define its size):</p>
  
  <pre class="lang-php prettyprint-override"><code>$cart = array();
  </code></pre>
  
  <p>Do I simply add elements to it using the following?</p>
  
  <pre class="lang-php prettyprint-override"><code>$cart[] = 13;
  $cart[] = "foo";
  $cart[] = obj;
  </code></pre>
  
  <p>Don't arrays in PHP have an add method, for example, <code>cart.add(13)</code>?</p>