How to extract all digits from a string in PHP?
In this article, To get the list of all numbers in a String, use the regular expression ‘[0-9]+’ with re.findall() method. [0-9] represents a regular expression to match a single digit in the string. [0-9]+ represents continuous digit sequences of any length.
1. Code:
2. Example:
Input:
string input: "Soltuts.com1234 providing PHP 5tutorials, tips, tricks"
Output:
output: 12345