3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('foo' => 'bar'); foreach (array('foo', 'baz') as $key) { $var1 = $arr[$key] || 'fooDefault'; $var2 = $arr[$key] && $arr[$key]; var_dump($var1); var_dump($var2); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 19
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
Branch analysis from position: 6
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/QlK4c
function name:  (null)
number of ops:  21
compiled vars:  !0 = $arr, !1 = $key, !2 = $var1, !3 = $var2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1      > FE_RESET_R                                       $5      <array>, ->19
          2    > > FE_FETCH_R                                               $5, !1, ->19
    5     3    >   FETCH_DIM_R                                      ~6      !0, !1
          4      > JMPNZ_EX                                         ~6      ~6, ->6
          5    >   BOOL                                             ~6      'fooDefault'
          6    >   ASSIGN                                                   !2, ~6
    6     7        FETCH_DIM_R                                      ~8      !0, !1
          8      > JMPZ_EX                                          ~8      ~8, ->11
          9    >   FETCH_DIM_R                                      ~9      !0, !1
         10        BOOL                                             ~8      ~9
         11    >   ASSIGN                                                   !3, ~8
    8    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
    9    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
    4    18      > JMP                                                      ->2
         19    >   FE_FREE                                                  $5
   10    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.13 ms | 1395 KiB | 15 Q