3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isset_or(&$check, $alternate = NULL) { return (isset($check)) ? $check : $alternate; } $orig = ['alpha' => 1]; $tested = $orig; echo 'isset_or($tested["beta"]): ', isset_or($tested['beta'], 'nope'); var_export([ '$orig' => $orig, '$tested' => $tested, 'array_key_exists("beta")' => [ '$orig' => array_key_exists('beta', $orig), '$tested' => array_key_exists('beta', $tested), ], ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vmFR
function name:  (null)
number of ops:  20
compiled vars:  !0 = $orig, !1 = $tested
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, !0
   11     2        ECHO                                                     'isset_or%28%24tested%5B%22beta%22%5D%29%3A+'
          3        INIT_FCALL                                               'isset_or'
          4        FETCH_DIM_W                                      $4      !1, 'beta'
          5        SEND_REF                                                 $4
          6        SEND_VAL                                                 'nope'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   13     9        INIT_FCALL                                               'var_export'
   14    10        INIT_ARRAY                                       ~6      !0, '%24orig'
   15    11        ADD_ARRAY_ELEMENT                                ~6      !1, '%24tested'
   17    12        ARRAY_KEY_EXISTS                                 ~7      'beta', !0
         13        INIT_ARRAY                                       ~8      ~7, '%24orig'
   18    14        ARRAY_KEY_EXISTS                                 ~9      'beta', !1
         15        ADD_ARRAY_ELEMENT                                ~8      ~9, '%24tested'
         16        ADD_ARRAY_ELEMENT                                ~6      ~8, 'array_key_exists%28%22beta%22%29'
         17        SEND_VAL                                                 ~6
   13    18        DO_ICALL                                                 
   20    19      > RETURN                                                   1

Function isset_or:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vmFR
function name:  isset_or
number of ops:  9
compiled vars:  !0 = $check, !1 = $alternate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    5     2        ISSET_ISEMPTY_CV                                         !0
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      !0
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      !1
          7    > > RETURN                                                   ~3
    6     8*     > RETURN                                                   null

End of function isset_or

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.08 ms | 1448 KiB | 15 Q