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, implode(',', $haystack), $m) ? $m[0] : [] );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5h2ZL
function name:  (null)
number of ops:  29
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%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                                               'implode'
         15        SEND_VAL                                                 '%2C'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        SEND_REF                                                 !3
         20        DO_ICALL                                         $10     
         21      > JMPZ                                                     $10, ->25
   13    22    >   FETCH_DIM_R                                      ~11     !3, 0
         23        QM_ASSIGN                                        ~12     ~11
         24      > JMP                                                      ->26
   14    25    >   QM_ASSIGN                                        ~12     <array>
         26    >   SEND_VAL                                                 ~12
   11    27        DO_ICALL                                                 
   15    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151 ms | 1014 KiB | 17 Q