3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { function __construct( array $config ) { $func = $config['func']; $value = 'Hello World'; echo $func( $value ); // This part throws the error } } $class = new MyClass( array( 'func' => function( $v ) { return $v; } ));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fbq5g
function name:  (null)
number of ops:  7
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'MyClass'
   11     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFbq5g%3A11%240'
          2        INIT_ARRAY                                       ~3      ~2, 'func'
          3        SEND_VAL_EX                                              ~3
          4        DO_FCALL                                      0          
   10     5        ASSIGN                                                   !0, $1
   12     6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFbq5g%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fbq5g
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1      > RETURN                                                   !0
          2*     > RETURN                                                   null

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

Class MyClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fbq5g
function name:  __construct
number of ops:  9
compiled vars:  !0 = $config, !1 = $func, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_DIM_R                                      ~3      !0, 'func'
          2        ASSIGN                                                   !1, ~3
    5     3        ASSIGN                                                   !2, 'Hello+World'
    6     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAR_EX                                              !2
          6        DO_FCALL                                      0  $6      
          7        ECHO                                                     $6
    7     8      > RETURN                                                   null

End of function __construct

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.49 ms | 1394 KiB | 13 Q