3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "TeSt", "Te s-t", "", "Te4St" ]; foreach ($strings as $string) { if(preg_match('#^[a-z -]+$#i', $string, $matches)){ echo $matches[0] . PHP_EOL; } }

preferences:
26.56 ms | 404 KiB | 5 Q