title: How to return values from an associative array in a php class
body: <p>I'm new to PHP and I'm only just starting to find my way, but I'm having  trouble getting values out of a public associative array using a public function which incorporates a <code>foreach()</code> loop. PHP code is encapsulated as a class and embedded within a html file. The html content is being displayed without any problems, but the PHP section is not returning any results.</p>
  
  <p>The code I've been trying to use is shown. I've checked the code through several php validators and there are no syntax errors being returned, but I'm obviously missing something in the code which is preventing</p>
  
  <pre><code>&lt;?php
  class balances {
  
      public $custBalances = [
          'Customer 1' =&gt; 450,
          'Customer 2' =&gt; 900,
          'Customer 3' =&gt; 0,
          'Customer 4' =&gt; 450
      ];
  
      public function oustandingBalances() {
          foreach ($custBalances as $key =&gt; $value) {
              if ($value == 0)
                  continue;
              echo "&lt;p&gt;$key is $value.&lt;/P&gt;";
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>The php should return results for Customer 1, Customer 2 and Customer 4. Any help is greatly appreciated.</p>