$numbers = preg_replace('/[^0-9]/', '', $str);
$letters = preg_replace('/[^a-zA-Z]/', '', $str);
More Related Contents:
- How do I check if a string contains a specific word?
- How to select first 10 words of a sentence?
- PHP substring extraction. Get the string before the first ‘/’ or the whole string
- Getting the first character of a string with $str[0]
- What is the fastest way to find the occurrence of a string in another string? [duplicate]
- Split a comma-delimited string into an array?
- startsWith() and endsWith() functions in PHP
- Why does PHP consider 0 to be equal to a string?
- How to get a substring between two strings in PHP?
- Replacing accented characters php
- Convert a comma-delimited string into array of integers?
- How to get everything after a certain character?
- Get first 100 characters from string, respecting full words
- PHP remove special character from string
- Iterate over each line in a string in PHP
- Generate SEO friendly URLs (slugs) [closed]
- How to get int instead string from form?
- Print newline in PHP in single quotes
- PHP: How to sort the characters in a string?
- Multi-line strings in PHP
- Why does PHP convert a string with the letter E into a number?
- Check if URL has certain string with PHP
- PHP: Split string into array, like explode with no delimiter
- how to extract links and titles from a .html page?
- Remove Trailing Slash From String PHP
- Measure string size in Bytes in php
- How to validate that a string only contain lowercase letters?
- Remove everything from the first occurrence of a character to the end of a string in PHP
- Regex to match an IP address [closed]
- How do I detect non-ASCII characters in a string?