Variable function calls

<?php
$callable
= array($x, $y);
call_user_func($callable);
$callable();
?>

call_user_func works. However, $callable() does not. Even on PHP 5.4 and later when the two supposed to be identical. How can that can be?

<?php
class x {
  function
foo() {
    print
"foo";
  }
  function
bar() {
   
$x = array(get_class(), "self::foo");
   
call_user_func($x);
   
$x();
  }
}
$a = new x;
$a->bar();
?>

foo
Fatal error: Call to undefined method x::x::foo() in /in/pqZdR on line 9

Process exited with code 255.

http://3v4l.org/PaKsD

Changing self to x gets rid of the warning in HHVM but not the fatal in Zend Engine:

http://3v4l.org/pqZdR

To clarify, two fatal errors would be fine. But one works and the other one doesn't -- so there are two separate code paths for these. Good to know!

Credit goes to aneek for finding this gem.