3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1, 2, 3, 4]; $index = 2; $value = 9; $remains = array_splice($array, max(0, $index - 1)); var_export( array_merge( $array, [$value], $remains ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RfQ7Q
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $index, !2 = $value, !3 = $remains
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 2
    5     2        ASSIGN                                                   !2, 9
    6     3        INIT_FCALL                                               'array_splice'
          4        SEND_REF                                                 !0
          5        INIT_FCALL                                               'max'
          6        SEND_VAL                                                 0
          7        SUB                                              ~7      !1, 1
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                         $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !3, $9
    7    13        INIT_FCALL                                               'var_export'
    8    14        INIT_FCALL                                               'array_merge'
    9    15        SEND_VAR                                                 !0
   10    16        INIT_ARRAY                                       ~11     !2
         17        SEND_VAL                                                 ~11
   11    18        SEND_VAR                                                 !3
    8    19        DO_ICALL                                         $12     
   11    20        SEND_VAR                                                 $12
    7    21        DO_ICALL                                                 
   13    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.33 ms | 1002 KiB | 17 Q