3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'text 1 2 and 3 text', 'text 3 9 25 text', 'text 9 25 48 text', ); foreach ($array as $color) { echo "\n---\n$color"; echo "\n\t" , preg_match('~\b[1-8]\b~', $color, $out) ? "checked (satisfied by {$out[0]})" : 'not found'; echo "\n\tChad says: " , (strpos($color,'1') || strpos($color,'2') || strpos($color,'3') || strpos($color,'4') || strpos($color,'5') || strpos($color,'6') || strpos($color,'7') || strpos($color,'8') ? 'found' : 'not found'); }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
--- text 1 2 and 3 text checked (satisfied by 1) Chad says: found --- text 3 9 25 text checked (satisfied by 3) Chad says: found --- text 9 25 48 text not found Chad says: found

preferences:
121.54 ms | 408 KiB | 5 Q