3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $func = null; public function __construct($func) { $this->func = $func; } public function exec() { $this->func(); } } $a = new A(function() { echo 'works'; }); $a->exec();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R67L7
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'A'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR67L7%3A15%240'
   17     2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
   15     4        ASSIGN                                                   !0, $1
   19     5        INIT_METHOD_CALL                                         !0, 'exec'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

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

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

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

End of function __construct

Function exec:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R67L7
function name:  exec
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_METHOD_CALL                                         'func'
          1        DO_FCALL                                      0          
   12     2      > RETURN                                                   null

End of function exec

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.15 ms | 1395 KiB | 13 Q