3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); $key = 'd'; if( array_key_exists( $key, $data )): $pos = array_search( array_keys( $key, $data ) ); $start = array_slice( $data, 0, $pos ); $end = array_slice( $data, $pos, count( $data ) ); $data = array_merge( $start, array( NULL ), $end ); endif; var_dump( $data );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/oIYkI
function name:  (null)
number of ops:  35
compiled vars:  !0 = $data, !1 = $key, !2 = $pos, !3 = $start, !4 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 'd'
    4     2        ARRAY_KEY_EXISTS                                         !1, !0
          3      > JMPZ                                                     ~7, ->31
    5     4    >   INIT_FCALL                                               'array_search'
          5        INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $8      
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
    6    12        INIT_FCALL                                               'array_slice'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 0
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !3, $11
    7    18        INIT_FCALL                                               'array_slice'
         19        SEND_VAR                                                 !0
         20        SEND_VAR                                                 !2
         21        COUNT                                            ~13     !0
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !4, $14
    8    25        INIT_FCALL                                               'array_merge'
         26        SEND_VAR                                                 !3
         27        SEND_VAL                                                 <array>
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !0, $16
   10    31    >   INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.35 ms | 1396 KiB | 23 Q