$b = new stdClass;
$b->method = function($x) { var_dump( $x); };
$b->method->__invoke('dads'); // string(4) "dads"
$b->method('dads'); // PHP Fatal error: Call to undefined method stdClass::method() in php shell code on line 1
($b->method)('dads'); // PHP Parse error: syntax error, unexpected '(' in php shell code on line 1


2 thoughts on “Забавно

    1. тут нет get-а

      а любая ссылка на функцию должна вести себя как функция

      php > $z = $b->method;
      php > $z(1);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.