3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array('1 ½ cups','¼ cup','2 tablespoons', '½ cup', '1/3 cup', '2 large', '1 ½ teaspoons', '2 tablespoons', 'Large egg', '1 teaspoon', '¼ teaspoon'); foreach($array as $arr){ preg_match_all("/^(?:[\p{Pd}.\/\s-]*[\d↉½⅓⅔¼¾⅕⅖⅗⅘⅙⅚⅐⅛⅜⅝⅞⅑⅒⅟]|)+/um", $arr, $output); foreach($output[0] as $data){ $try[] = $data; } } var_dump($try);
Output for 7.0.0 - 7.0.24, 7.1.0 - 7.1.33, 7.2.6 - 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 - 8.3.7
array(11) { [0]=> string(4) "1 ½" [1]=> string(2) "¼" [2]=> string(1) "2" [3]=> string(2) "½" [4]=> string(3) "1/3" [5]=> string(1) "2" [6]=> string(4) "1 ½" [7]=> string(1) "2" [8]=> string(0) "" [9]=> string(1) "1" [10]=> string(2) "¼" }
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(11) { [0]=> string(4) "1 ½" [1]=> string(2) "¼" [2]=> string(1) "2" [3]=> string(2) "½" [4]=> string(3) "1/3" [5]=> string(1) "2" [6]=> string(4) "1 ½" [7]=> string(1) "2" [8]=> string(0) "" [9]=> string(1) "1" [10]=> string(2) "¼" }

preferences:
183.56 ms | 402 KiB | 209 Q