title: Declaring closure to class attribute in PHP
body: <p>Its strange, i can do</p>
  
  <pre><code>&lt;?php
  
      $foo = function($a){
          return $a;
      };
  
  var_dump($foo(123));
  </code></pre>
  
  <p>But in the scope of a classe if a do:</p>
  
  <pre><code>&lt;?php
  
      class Totalizer{
  
          public $count;
  
          public function __construct(){
              $this-&gt;count = function($product){
                  return  $product;
              };
          }
  
      }
  
      $foo = new Totalizer;
      var_dump($foo-&gt;count(123));
  </code></pre>
  
  <p><strong>Fatal error: Call to undefined method Totalizer::count()</strong> </p>
  
  <p>My question is how can i do the same as the first snippet but in class scope?</p>
  
  <p>ps: PHP 5.5</p>