$result = preg_replace("/[^a-zA-Z0-9]+/", "", $s);
To get the first character from a string, we can use the substr() function by passing 0,1 as second and third arguments in PHP.
$alphas = range('A', 'Z');
Documentation: https://www.php.net/manual/en/function.range.php
To get both upper and lower case merge the two ranges:
$alphas = array_merge(range('A', 'Z'), range('a', 'z'));
$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
Another way:
$c = 'A';
$chars = array($c);
while ($c < 'Z') $chars[] = ++$c;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With