3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( '1st' => 'a', '2nd' => 'b', '3rd' => 'b' ); foreach($array as $key => &$value) { if($value === 'a') { $array['1st'] = '1'; $array['2nd'] = '2'; array_splice($array, 0, 0, array('x')); //array pointer 초기화 //array_splice($array, count($array), 0, array('y')); //array pointer 초기화 } var_dump($key . ' - ' . $value); } unset($value);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/arSVc
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_RW                                      $4      !0, ->22
          2    > > FE_FETCH_RW                                      ~5      $4, !1, ->22
          3    >   ASSIGN                                                   !2, ~5
   10     4        IS_IDENTICAL                                             !1, 'a'
          5      > JMPZ                                                     ~7, ->16
   12     6    >   ASSIGN_DIM                                               !0, '1st'
          7        OP_DATA                                                  '1'
   13     8        ASSIGN_DIM                                               !0, '2nd'
          9        OP_DATA                                                  '2'
   14    10        INIT_FCALL                                               'array_splice'
         11        SEND_REF                                                 !0
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 0
         14        SEND_VAL                                                 <array>
         15        DO_ICALL                                                 
   17    16    >   INIT_FCALL                                               'var_dump'
         17        CONCAT                                           ~11     !2, '+-+'
         18        CONCAT                                           ~12     ~11, !1
         19        SEND_VAL                                                 ~12
         20        DO_ICALL                                                 
    8    21      > JMP                                                      ->2
         22    >   FE_FREE                                                  $4
   19    23        UNSET_CV                                                 !1
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.7 ms | 1400 KiB | 17 Q