3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { echo __FUNCTION__, "\n"; return 'key'; } echo "??=\n"; $array = []; $array[foo()] ??= 'default'; echo "\nrough equivalent\n"; $array = []; if (!isset($array[foo()])) { $array[foo()] = 'default'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/ITSK6
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     '%3F%3F%3D%0A'
    9     1        ASSIGN                                                   !0, <array>
   10     2        INIT_FCALL                                               'foo'
          3        DO_FCALL                                      0  $2      
          4        COPY_TMP                                         $3      $2
          5        FETCH_DIM_IS                                     ~4      !0, $2
          6        COALESCE                                         ~5      ~4
          7        ASSIGN_DIM                                       ~6      !0, $3
          8        OP_DATA                                                  'default'
          9        QM_ASSIGN                                        ~5      ~6
         10      > JMP                                                      ->12
         11*       FREE                                                     $3
         12    >   FREE                                                     ~5
   12    13        ECHO                                                     '%0Arough+equivalent%0A'
   13    14        ASSIGN                                                   !0, <array>
   14    15        INIT_FCALL                                               'foo'
         16        DO_FCALL                                      0  $8      
         17        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !0, $8
         18        BOOL_NOT                                         ~10     ~9
         19      > JMPZ                                                     ~10, ->24
   15    20    >   INIT_FCALL                                               'foo'
         21        DO_FCALL                                      0  $11     
         22        ASSIGN_DIM                                               !0, $11
         23        OP_DATA                                                  'default'
   16    24    > > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ITSK6
function name:  foo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'foo'
          1        ECHO                                                     '%0A'
    5     2      > RETURN                                                   'key'
    6     3*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.48 ms | 1399 KiB | 16 Q