3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack = array(1,2,3,4,5,6,7,8,9,10); $needle = array(3,4,5); $bad_needle = array(3,5,4); $offset = array_search($needle[0], $haystack); $slice = array_slice($haystack, $offset, count($needle)); if ($slice === $needle) { echo 'yes'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/p89o4
function name:  (null)
number of ops:  20
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $bad_needle, !3 = $offset, !4 = $slice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'array_search'
          4        FETCH_DIM_R                                      ~8      !1, 0
          5        SEND_VAL                                                 ~8
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !3, $9
    8     9        INIT_FCALL                                               'array_slice'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !3
         12        COUNT                                            ~11     !1
         13        SEND_VAL                                                 ~11
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !4, $12
    9    16        IS_IDENTICAL                                             !4, !1
         17      > JMPZ                                                     ~14, ->19
   10    18    >   ECHO                                                     'yes'
   11    19    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.67 ms | 1395 KiB | 17 Q