3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '1234@#$ABCFG3478&*'; if (preg_match('/[a-z]/i', $string, $match)) { $firstLetter = $match[0]; } else { // there's no letters in string } echo $firstLetter;

preferences:
47.22 ms | 402 KiB | 5 Q