3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function add_function($name, $function) { $this->$name = $function; } } $foo = new Foo(); $foo->add_function('bar', function() { echo "hello, world"; }); $foo->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7W6HT
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    9     3        INIT_METHOD_CALL                                         !0, 'add_function'
          4        SEND_VAL_EX                                              'bar'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7W6HT%3A9%240'
          6        SEND_VAL_EX                                              ~4
          7        DO_FCALL                                      0          
   10     8        INIT_METHOD_CALL                                         !0, 'bar'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F7W6HT%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7W6HT
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'hello%2C+world'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F7W6HT%3A9%240

Class Foo:
Function add_function:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7W6HT
function name:  add_function
number of ops:  5
compiled vars:  !0 = $name, !1 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN_OBJ                                               !0
          3        OP_DATA                                                  !1
    5     4      > RETURN                                                   null

End of function add_function

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.91 ms | 1394 KiB | 13 Q