3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $chosen = "get_emails"; public function bar(): callable { return function() { $this->{$this->chosen}(); }; } public function get_emails(): void { echo __METHOD__; } } $foo = new Foo(); $func = $foo->bar(); $func();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fcMto
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   16     6        INIT_DYNAMIC_CALL                                        !1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfcMto%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fcMto
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       $0      
          1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_R                                      ~2      $1, 'chosen'
          3        INIT_METHOD_CALL                                         $0, ~2
          4        DO_FCALL                                      0          
          5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfcMto%3A6%240

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fcMto
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfcMto%3A6%240'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
    7     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function bar

Function get_emails:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fcMto
function name:  get_emails
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'Foo%3A%3Aget_emails'
   11     1      > RETURN                                                   null

End of function get_emails

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.46 ms | 1395 KiB | 13 Q