3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $callable; public function __construct(callable $callable) { $this->callable = $callable; } } $foo = new Foo(function () { var_dump('holy syntax batman!'); }); $foo->callable->__invoke();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n4TMF
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'Foo'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fn4TMF%3A11%240'
   13     2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
   11     4        ASSIGN                                                   !0, $1
   15     5        FETCH_OBJ_R                                      ~5      !0, 'callable'
          6        INIT_METHOD_CALL                                         ~5, '__invoke'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fn4TMF%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n4TMF
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'holy+syntax+batman%21'
          2        DO_ICALL                                                 
   13     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fn4TMF%3A11%240

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

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.2 ms | 1387 KiB | 15 Q