I got a string like:
$str = \"CASH55.35inMyPocket\";
I want to get 55.35 only.
I tried:
$str = flo
You can try a little Function to extract that value for you before using either floatval or (float).
Something like:
function myFloats($str) {
if(preg_match("#([0-9\.]+)#", $str, $match)) { // search for number that may contain '.'
return floatval($match[0]);
} else {
return floatval($str); // take some last chances with floatval
}
}
then test:
echo myFloats("CASH55.35inMyPocket");