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
$str = 'In My Cart : 11 12 items'; $str = preg_replace('/\D/', '', $str); echo $str;