3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('VOID', INF); function ifsetter(&$mElement, $mDefault = '') { if (!isset($mElement) OR $mElement === VOID){ $mElement = $mDefault; } return $mElement; } $t = []; echo ifsetter($t['aaa'], 'hello'); // return 'hello' and set $t['aaa'] = 'hello';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IoOuH
function name:  (null)
number of ops:  12
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'VOID'
          2        SEND_VAL                                                 INF
          3        DO_ICALL                                                 
   12     4        ASSIGN                                                   !0, <array>
   13     5        INIT_FCALL                                               'ifsetter'
          6        FETCH_DIM_W                                      $3      !0, 'aaa'
          7        SEND_REF                                                 $3
          8        SEND_VAL                                                 'hello'
          9        DO_FCALL                                      0  $4      
         10        ECHO                                                     $4
         11      > RETURN                                                   1

Function ifsetter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 8
filename:       /in/IoOuH
function name:  ifsetter
number of ops:  12
compiled vars:  !0 = $mElement, !1 = $mDefault
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
    6     2        ISSET_ISEMPTY_CV                                 ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPNZ_EX                                         ~3      ~3, ->8
          5    >   FETCH_CONSTANT                                   ~4      'VOID'
          6        IS_IDENTICAL                                     ~5      !0, ~4
          7        BOOL                                             ~3      ~5
          8    > > JMPZ                                                     ~3, ->10
    7     9    >   ASSIGN                                                   !0, !1
    9    10    > > RETURN                                                   !0
   10    11*     > RETURN                                                   null

End of function ifsetter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.21 ms | 1398 KiB | 16 Q