title: Initialize class property with an anonymous function
body: <p>Why is not possible to initialize a property to a function when you declare the property in php? The following snippit results in a <strong>Parse error: syntax error, unexpected T_FUNCTION</strong></p>
  
  <pre><code>&lt;?php
    class AssignAnonFunction {
      private $someFunc = function() {
        echo "Will Not work";
      };
    }
  ?&gt;
  </code></pre>
  
  <p>Yet you can initialize a property to a string, number or other data types?</p>
  
  <p>Edit:</p>
  
  <p>But I can assign a function to a property in the __construct() method. The following does work:</p>
  
  <pre><code>&lt;?php
    class AssignAnonFunctionInConstructor {
      private $someFunc;
  
      public function __construct() {
        $this-&gt;someFunc = function() {
          echo "Does Work";
        };
      }
    }
  ?&gt;
  </code></pre>