BBGaming Posted July 31, 2007 Share Posted July 31, 2007 I want to strip all letters from a string. Either that, or find out how many letters there are. How could I do this? Quote Link to comment https://forums.phpfreaks.com/topic/62608-number-of-letters/ Share on other sites More sharing options...
clearstatcache Posted July 31, 2007 Share Posted July 31, 2007 not sure if ds s wat u want... 8s how i understand ur prob... <?php $str = 'a2b5cdef23g9=#'; $str_letters_only = preg_replace('/[^a-z]/','',$str); $num_letters = strlen($str_letters_only); print "$str_letters_only\n$num_letters\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/62608-number-of-letters/#findComment-311658 Share on other sites More sharing options...
BBGaming Posted July 31, 2007 Author Share Posted July 31, 2007 preg_replace? Could you explain what that is? Quote Link to comment https://forums.phpfreaks.com/topic/62608-number-of-letters/#findComment-311662 Share on other sites More sharing options...
clearstatcache Posted July 31, 2007 Share Posted July 31, 2007 visit the php manual for more info... http://www.php.net/manual/en/function.preg-replace.php Quote Link to comment https://forums.phpfreaks.com/topic/62608-number-of-letters/#findComment-311664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.