3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(111,112,113,114,115); $val = 113; // search $arr for $val … if ( ($dex = array_search($val, $arr)) !== false) { // reconstruct $arr $arr = array_merge(array_slice($arr,0,$dex), array_slice($arr,$dex + 1)); } // 113 removed var_dump($arr);// [0]=> int(111), [1]=> int(112), [2]=> int(114), [3]=>int(115)
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/8fZOH
function name:  (null)
number of ops:  28
compiled vars:  !0 = $arr, !1 = $val, !2 = $dex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 113
    7     2        INIT_FCALL                                               'array_search'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                           ~6      !2, $5
          7        TYPE_CHECK                                  1018          ~6
          8      > JMPZ                                                     ~7, ->24
   10     9    >   INIT_FCALL                                               'array_merge'
         10        INIT_FCALL                                               'array_slice'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
   11    16        INIT_FCALL                                               'array_slice'
         17        SEND_VAR                                                 !0
         18        ADD                                              ~9      !2, 1
         19        SEND_VAL                                                 ~9
         20        DO_ICALL                                         $10     
         21        SEND_VAR                                                 $10
         22        DO_ICALL                                         $11     
   10    23        ASSIGN                                                   !0, $11
   14    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:
166.45 ms | 1387 KiB | 21 Q