3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/(?:[0-9]+g|A handful).*?(?=\s*(?:[0-9]+g|A handful|$))/m'; $str = '35g walnut halves A handful of thyme leaves 200g portobello mushrooms 200g white mushrooms 200g chifferini pasta 100g Petit Brebis sheep\'s cheese 40g honey'; if (preg_match_all($re, $str, $matches)) { print_r($matches[0]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/MLnKk
function name:  (null)
number of ops:  13
compiled vars:  !0 = $re, !1 = $str, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28%3F%3A%5B0-9%5D%2Bg%7CA+handful%29.%2A%3F%28%3F%3D%5Cs%2A%28%3F%3A%5B0-9%5D%2Bg%7CA+handful%7C%24%29%29%2Fm'
    4     1        ASSIGN                                                   !1, '35g+walnut+halves+A+handful+of+thyme+leaves+200g+portobello+mushrooms+200g+white+mushrooms+200g+chifferini+pasta+100g+Petit+Brebis+sheep%27s+cheese+40g+honey'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $5      
          7      > JMPZ                                                     $5, ->12
    6     8    >   INIT_FCALL                                               'print_r'
          9        FETCH_DIM_R                                      ~6      !2, 0
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
    7    12    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.71 ms | 1005 KiB | 15 Q