3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array('a' => 'a', 'b' => 'b', 'c' => 'c'); $oldKey = 'b'; $newKey = 'new'; array_splice($arr, 1, 1, array($newKey => $arr[$oldKey])); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zr52r
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr, !1 = $oldKey, !2 = $newKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'b'
    5     2        ASSIGN                                                   !2, 'new'
    6     3        INIT_FCALL                                               'array_splice'
          4        SEND_REF                                                 !0
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 1
          7        FETCH_DIM_R                                      ~6      !0, !1
          8        INIT_ARRAY                                       ~7      ~6, !2
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                                 
    7    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.57 ms | 1394 KiB | 17 Q