3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '`\b(?:Sunscreen|Lubricant)\h+[^()]*\((\d+)\h+Quantity\)`'; $str = 'Sunscreen 25g (200 Quantity) Lubricant 100ml (50 Quantity)'; preg_match_all($re, $str, $matches); $result = array_map("intval", $matches[1]); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XBIEs
function name:  (null)
number of ops:  17
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%60%5Cb%28%3F%3ASunscreen%7CLubricant%29%5Ch%2B%5B%5E%28%29%5D%2A%5C%28%28%5Cd%2B%29%5Ch%2BQuantity%5C%29%60'
    4     1        ASSIGN                                                   !1, 'Sunscreen+25g+%28200+Quantity%29%0ALubricant+100ml+%2850+Quantity%29'
    7     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    9     7        INIT_FCALL                                               'array_map'
          8        SEND_VAL                                                 'intval'
          9        FETCH_DIM_R                                      ~7      !2, 1
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !3, $8
   10    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.73 ms | 1003 KiB | 16 Q