3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { const LABELS = [ 'a' => 'Hello', 'b' => 'World' ]; const UNKNOWN_LABEL = 'unknown'; public static function test($module) { self::LABELS[$module] ?? self::UNKNOWN_LABEL; } } $a = []; $a[] = x::test('a'); $a[] = x::test('b'); $a[] = x::test('c'); $a[] = x::test(null); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSpheA
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                       !0, <array>
   18     1        INIT_STATIC_METHOD_CALL                                      'x', 'test'
          2        SEND_VAL                                                     'a'
          3        DO_FCALL                                          0  $3      
          4        ASSIGN_DIM                                                   !0
          5        OP_DATA                                                      $3
   19     6        INIT_STATIC_METHOD_CALL                                      'x', 'test'
          7        SEND_VAL                                                     'b'
          8        DO_FCALL                                          0  $5      
          9        ASSIGN_DIM                                                   !0
         10        OP_DATA                                                      $5
   20    11        INIT_STATIC_METHOD_CALL                                      'x', 'test'
         12        SEND_VAL                                                     'c'
         13        DO_FCALL                                          0  $7      
         14        ASSIGN_DIM                                                   !0
         15        OP_DATA                                                      $7
   21    16        INIT_STATIC_METHOD_CALL                                      'x', 'test'
         17        SEND_VAL                                                     null
         18        DO_FCALL                                          0  $9      
         19        ASSIGN_DIM                                                   !0
         20        OP_DATA                                                      $9
   23    21        INIT_FCALL                                                   'var_dump'
         22        SEND_VAR                                                     !0
         23        DO_ICALL                                                     
         24      > RETURN                                                       1

Class x:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSpheA
function name:  test
number of ops:  6
compiled vars:  !0 = $module
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   13     1        FETCH_DIM_IS                                         ~1      <array>, !0
          2        COALESCE                                             ~2      ~1
          3        QM_ASSIGN                                            ~2      'unknown'
          4        FREE                                                         ~2
   14     5      > RETURN                                                       null

End of function test

End of class x.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.9 ms | 3433 KiB | 14 Q