3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = 256; $array = array( 125 => array(571, 570), 284 => array(567, 566), 256 => array(562, 560), 110 => array(565, 563), ); $position = array_search($key, array_keys($array)); $output = array_slice($array, 0, $position); print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nmnDv
function name:  (null)
number of ops:  20
compiled vars:  !0 = $key, !1 = $array, !2 = $position, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 256
    5     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'array_search'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
   14    10        INIT_FCALL                                               'array_slice'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !3, $9
   16    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.98 ms | 1013 KiB | 17 Q