title: Define value of class when assigned to variable in PHP
body: <p>In PHP I can use \ArrayAccess to create an object such that it can be assigned as variable (an array) but also execute some other stuff while doing it, is it possible to do the same with a single value variable?, for example:</p>
  
  <pre><code>$a = new MyClass(5, "some other stuff")-&gt;print(); //Prints 'some other stuff'
  $b = $a * 2;
  echo $b; //Prints 10
  </code></pre>
  
  <p>The idea would be that the first parameter is returned when the variable is assigned but at the same time I can do something else with the second parameter, so far I have only manage to do it ussing the __invoke magic method, but the end result is something like this:</p>
  
  <pre><code>$a = new MyClass(5, "some other stuff")-&gt;print(); //Prints 'some other stuff'
  $b = $a() * 2;
  echo $b; //Prints 10
  </code></pre>
  
  <p>Is it possible to do it without the __invoke method?</p>