3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '<p>Die folgenden Gebühren sind direkt in der Unterkunft zu bezahlen: </p> <ul><li>Kaution: 100 USD pro Tag</li><li>Hotelgebühr: 39.68 USD pro Unterkunft, pro Nacht</li></ul> Die Hotelgebühr enthält: <ul><li>Benutzung des Pools</li><li>Benutzung des Fitnesscenters oder -studios</li><li>Internetzugang</li><li>Telefongespräche</li></ul> <p>Diese Liste enthält alle Gebühren, die uns vom Hotel mitgeteilt wurden. Die erhobenen Gebühren können sich allerdings je nach Buchungszeitraum und Zimmerart ändern. USD 30 </p>'; $pattern = '((?P<precurrency>\S{1,3}) (?:\d{1,3}[,\.]?)+\d* (?P<postcurrency>\S{1,3}) )'; preg_match_all($pattern, $text, $currency); var_dump($currency);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
array(5) { [0]=> array(2) { [0]=> string(12) "on: 100 USD " [1]=> string(14) "hr: 39.68 USD " } ["precurrency"]=> array(2) { [0]=> string(3) "on:" [1]=> string(3) "hr:" } [1]=> array(2) { [0]=> string(3) "on:" [1]=> string(3) "hr:" } ["postcurrency"]=> array(2) { [0]=> string(3) "USD" [1]=> string(3) "USD" } [2]=> array(2) { [0]=> string(3) "USD" [1]=> string(3) "USD" } }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array(5) { [0]=> array(2) { [0]=> string(12) "on: 100 USD " [1]=> string(14) "hr: 39.68 USD " } ["precurrency"]=> array(2) { [0]=> string(3) "on:" [1]=> string(3) "hr:" } [1]=> array(2) { [0]=> string(3) "on:" [1]=> string(3) "hr:" } ["postcurrency"]=> array(2) { [0]=> string(3) "USD" [1]=> string(3) "USD" } [2]=> array(2) { [0]=> string(3) "USD" [1]=> string(3) "USD" } }

preferences:
194.77 ms | 402 KiB | 291 Q