3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "$20,000 AUD", "$20,000", "20,000 AUD", "$", "20,000", "AUD" ]; $re = '/(?P<symbol>[$¥£€₹])(?P<amount>\d{1,10}(?:[.,]\d{1,10})?)(?:\h+(?P<currency>AUD|USD|GBP|EURO?S?)\b)?\b|(?P<amount>\d{1,10}(?:[.,]\d{1,10})?)\h+(?P<currency>AUD|USD|GBP|EURO?S?)\b/J'; foreach ($strings as $s) { $m = preg_match($re, $s, $matches); if ($m) { print_r($matches); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/W1aed
function name:  (null)
number of ops:  17
compiled vars:  !0 = $strings, !1 = $re, !2 = $s, !3 = $m, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, '%2F%28%3FP%3Csymbol%3E%5B%24%C2%A5%C2%A3%E2%82%AC%E2%82%B9%5D%29%28%3FP%3Camount%3E%5Cd%7B1%2C10%7D%28%3F%3A%5B.%2C%5D%5Cd%7B1%2C10%7D%29%3F%29%28%3F%3A%5Ch%2B%28%3FP%3Ccurrency%3EAUD%7CUSD%7CGBP%7CEURO%3FS%3F%29%5Cb%29%3F%5Cb%7C%28%3FP%3Camount%3E%5Cd%7B1%2C10%7D%28%3F%3A%5B.%2C%5D%5Cd%7B1%2C10%7D%29%3F%29%5Ch%2B%28%3FP%3Ccurrency%3EAUD%7CUSD%7CGBP%7CEURO%3FS%3F%29%5Cb%2FJ'
   12     2      > FE_RESET_R                                       $7      !0, ->15
          3    > > FE_FETCH_R                                               $7, !2, ->15
   13     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !4
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   14    10      > JMPZ                                                     !3, ->14
   15    11    >   INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                                 
   12    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $7
   17    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.88 ms | 1011 KiB | 15 Q