3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack = [0,0,0,1,1,0,1,1,0,0,1,1,0,0,1]; $needle = [1,1,0]; $regex = sprintf( '/(?<=[\[,]%s,)\d+/', implode(',', $needle) ); var_export( preg_match_all($regex, json_encode($haystack), $m) ? $m[0] : [] );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SWVjC
function name:  (null)
number of ops:  28
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $regex, !3 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'sprintf'
    7     3        SEND_VAL                                                 '%2F%28%3F%3C%3D%5B%5C%5B%2C%5D%25s%2C%29%5Cd%2B%2F'
    8     4        INIT_FCALL                                               'implode'
          5        SEND_VAL                                                 '%2C'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
    6     9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
   11    11        INIT_FCALL                                               'var_export'
   12    12        INIT_FCALL                                               'preg_match_all'
         13        SEND_VAR                                                 !2
         14        INIT_FCALL                                               'json_encode'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $9      
         17        SEND_VAR                                                 $9
         18        SEND_REF                                                 !3
         19        DO_ICALL                                         $10     
         20      > JMPZ                                                     $10, ->24
   13    21    >   FETCH_DIM_R                                      ~11     !3, 0
         22        QM_ASSIGN                                        ~12     ~11
         23      > JMP                                                      ->25
   14    24    >   QM_ASSIGN                                        ~12     <array>
         25    >   SEND_VAL                                                 ~12
   11    26        DO_ICALL                                                 
   15    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
254.46 ms | 1014 KiB | 18 Q