3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array("1","2","3","4","5"); $array2 = array("apple","banana","","dog",""); $res = []; foreach($array1 as $ind=>$num){ $res[$num] = $array2[$ind] === "" ? "No Value" : $array2[$ind]; } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/060KT
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array1, !1 = $array2, !2 = $res, !3 = $num, !4 = $ind
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
    7     3      > FE_RESET_R                                       $8      !0, ->16
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->16
          5    >   ASSIGN                                                   !4, ~9
    8     6        FETCH_DIM_R                                      ~12     !1, !4
          7        IS_IDENTICAL                                             ~12, ''
          8      > JMPZ                                                     ~13, ->11
          9    >   QM_ASSIGN                                        ~14     'No+Value'
         10      > JMP                                                      ->13
         11    >   FETCH_DIM_R                                      ~15     !1, !4
         12        QM_ASSIGN                                        ~14     ~15
         13    >   ASSIGN_DIM                                               !2, !3
         14        OP_DATA                                                  ~14
    7    15      > JMP                                                      ->4
         16    >   FE_FREE                                                  $8
   11    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.48 ms | 1395 KiB | 15 Q