I want to extract the digits from a string that contains numbers and letters like:
"In My Cart : 11 items"
I want to extract the nu
Using preg_replace:
preg_replace
$str = '(111) 111-1111'; $str = preg_replace('/\D/', '', $str); echo $str;
Output: 1111111111