3v4l.org

run code in 500+ 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 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5h2ZL
function name:  (null)
number of ops:  22
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>
    8     2        FRAMELESS_ICALL_2                implode             ~6      '%2C', !1
          3        ROPE_INIT                                         3  ~8      '%2F%28%3F%3C%3D'
          4        ROPE_ADD                                          1  ~8      ~8, ~6
          5        ROPE_END                                          2  ~7      ~8, '%2C%29%5Cd%2B%2F'
    6     6        ASSIGN                                                       !2, ~7
   11     7        INIT_FCALL                                                   'var_export'
   12     8        INIT_FCALL                                                   'preg_match_all'
          9        SEND_VAR                                                     !2
         10        FRAMELESS_ICALL_2                implode             ~11     '%2C', !0
         11        SEND_VAL                                                     ~11
         12        SEND_REF                                                     !3
         13        DO_ICALL                                             $12     
         14      > JMPZ                                                         $12, ->18
   13    15    >   FETCH_DIM_R                                          ~13     !3, 0
         16        QM_ASSIGN                                            ~14     ~13
         17      > JMP                                                          ->19
   14    18    >   QM_ASSIGN                                            ~14     <array>
         19    >   SEND_VAL                                                     ~14
   11    20        DO_ICALL                                                     
   15    21      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.51 ms | 1887 KiB | 15 Q