3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 'test'; $function = match ($foo) { 'bar' => function () { $a = 'whatever'; return $a; }, 'test' => function () { return 'it works'; } }; echo $function();
Finding entry points
Branch analysis from position: 0
3 jumps found. (Code = 195) Position 1 = 3, Position 2 = 6, Position 3 = 2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 2
1 jumps found. (Code = 197) Position 1 = -2
filename:       /in/L3pVQ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foo, !1 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'test'
    5     1      > MATCH                                                    !0, [ 'bar':->3, 'test':->6, ], ->2
          2    > > MATCH_ERROR                                              !0
    6     3    >   DECLARE_LAMBDA_FUNCTION                          ~4      [0]
    9     4        QM_ASSIGN                                        ~5      ~4
          5      > JMP                                                      ->9
   10     6    >   DECLARE_LAMBDA_FUNCTION                          ~6      [1]
   12     7        QM_ASSIGN                                        ~5      ~6
          8      > JMP                                                      ->9
    5     9    >   ASSIGN                                                   !1, ~5
   15    10        INIT_DYNAMIC_CALL                                        !1
         11        DO_FCALL                                      0  $8      
         12        ECHO                                                     $8
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3pVQ
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'whatever'
    8     1      > RETURN                                                   !0
    9     2*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L3pVQ
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   'it+works'
   12     1*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.94 ms | 1430 KiB | 13 Q