3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array('one','two','three'); $array2 = array(); $array3 = array ('four'); $array4 = array ('five','six'); check([&$array1,&$array2,&$array3,&$array4]); function check($arr){ foreach ($arr as $k=>$value) { if(empty($value) == false){ $arr[$k] = "nothing"; return $arr[$k]; } else{ return $arr[$k]; } } } var_dump($array2); //actual output : empty //expect output : 0 => string 'nothing' ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lZUoh
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3, !3 = $array4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, <array>
    5     3        ASSIGN                                                   !3, <array>
    6     4        INIT_FCALL_BY_NAME                                       'check'
          5        INIT_ARRAY                                       ~8      !0
          6        ADD_ARRAY_ELEMENT                                ~8      !1
          7        ADD_ARRAY_ELEMENT                                ~8      !2
          8        ADD_ARRAY_ELEMENT                                ~8      !3
          9        SEND_VAL_EX                                              ~8
         10        DO_FCALL                                      0          
   18    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   21    14      > RETURN                                                   1

Function check:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/lZUoh
function name:  check
number of ops:  19
compiled vars:  !0 = $arr, !1 = $value, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1      > FE_RESET_R                                       $3      !0, ->17
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->17
          3    >   ASSIGN                                                   !2, ~4
    9     4        ISSET_ISEMPTY_CV                                 ~6      !1
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ                                                     ~7, ->13
   10     7    >   ASSIGN_DIM                                               !0, !2
          8        OP_DATA                                                  'nothing'
   11     9        FETCH_DIM_R                                      ~9      !0, !2
         10        FE_FREE                                                  $3
         11      > RETURN                                                   ~9
         12*       JMP                                                      ->16
   14    13    >   FETCH_DIM_R                                      ~10     !0, !2
         14        FE_FREE                                                  $3
         15      > RETURN                                                   ~10
    8    16*       JMP                                                      ->2
         17    >   FE_FREE                                                  $3
   17    18      > RETURN                                                   null

End of function check

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.12 ms | 1400 KiB | 15 Q