title: Get array length in a PHP class
body: <p>I'm new to object oriented programming in PHP.
  I made a simple order class with an array property.
  The method orderLength is not working. I'm getting an error:</p>
  
  <blockquote>
    <p>Call to undefined method Order::count()</p>
  </blockquote>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
      class Order {
          private $order = array();
  
          public function setOrder($wert) {
              foreach($wert as $value) {
                  $this -&gt; order[] = $value;
              }
          }
  
          public function orderLength() {
              $length = $this -&gt; count(order);
              return $length;
          }
  
          public function returnOrder() {
              $value = $this -&gt; order;
              return $value;
          }
      }
  
      $order = new Order;
      $order -&gt; setOrder(array('Book1', 'Book2', 'Book3', 'Book4'));
  
      foreach ($order-&gt;returnOrder() as $value) {
          echo $value . " &lt;br/&gt;";
      }
  
      echo "The order length is: " . $order-&gt;orderLength();
  </code></pre>