3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array('foo' => 'a', 'bar' => 'b', 'baz' => 'c'); $insert_array = array('one' => 'two'); $pos = array_search($key, array_keys($array)) ?: 0; $array = array_slice($array, 0, $pos) + $insert_array + array_slice($array, $pos); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LkKXn
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $insert_array, !2 = $pos, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_search'
          3        SEND_VAR                                                 !3
          4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        JMP_SET                                          ~8      $7, ->11
         10        QM_ASSIGN                                        ~8      0
         11        ASSIGN                                                   !2, ~8
    7    12        INIT_FCALL                                               'array_slice'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 0
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $10     
         17        ADD                                              ~11     $10, !1
         18        INIT_FCALL                                               'array_slice'
         19        SEND_VAR                                                 !0
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $12     
         22        ADD                                              ~13     ~11, $12
         23        ASSIGN                                                   !0, ~13
    9    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.38 ms | 1395 KiB | 21 Q