3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', true); 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/Auho0
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                                 
   18     7        NEW                                              $3      'A'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAuho0%3A18%240'
   20     9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0          
   18    11        ASSIGN                                                   !0, $3
   22    12        INIT_METHOD_CALL                                         !0, 'exec'
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FAuho0%3A18%240

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Auho0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'func'
          2        OP_DATA                                                  !0
   11     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/Auho0
function name:  exec
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                         'func'
          1        DO_FCALL                                      0          
   15     2      > RETURN                                                   null

End of function exec

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.68 ms | 1396 KiB | 17 Q