3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __call($method, $args) { if (isset($this->$method)) { $func = $this->$method; return call_user_func_array($func, $args); } } } $foo = new Foo(); $foo->bar = function () { echo "Hello, this function is added at runtime"; }; $foo->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0qkgf
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0qkgf%3A15%240'
          4        ASSIGN_OBJ                                               !0, 'bar'
          5        OP_DATA                                                  ~5
   16     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0qkgf%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0qkgf
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     'Hello%2C+this+function+is+added+at+runtime'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0qkgf%3A15%240

Class Foo:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0qkgf
function name:  __call
number of ops:  12
compiled vars:  !0 = $method, !1 = $args, !2 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ISSET_ISEMPTY_PROP_OBJ                                   !0
          3      > JMPZ                                                     ~3, ->11
    8     4    >   FETCH_OBJ_R                                      ~4      !0
          5        ASSIGN                                                   !2, ~4
    9     6        INIT_USER_CALL                                0          'call_user_func_array', !2
          7        SEND_ARRAY                                               !1
          8        CHECK_UNDEF_ARGS                                         
          9        DO_FCALL                                      0  $6      
         10      > RETURN                                                   $6
   11    11    > > RETURN                                                   null

End of function __call

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.96 ms | 1399 KiB | 13 Q