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
This functions will also handle the floating numbers
$str = "Doughnuts, 4; doughnuts holes, 0.08; glue, 3.4"; $str = preg_replace('/[^0-9\.]/','-', $str); $str = preg_replace('/(\-+)(\.\.+)/','-', $str); $str = trim($str, '-'); $arr = explode('-', $str);