Hi everybody.
I have to get the numeric part of a field, for example, from:
5400,50 Frs/personne
I would like to get:
5400,50
I could use a string function to get it, but the problem is that everybody won't write this string the same way, so i couldn't for example, use space or even F.
So i decided to use a variable conversion.
That is where is my problem:
I first remove the spaces, and then i convert the variable (wich is a string)
in a numeric type. Then i convert the type, explicit way.
But neither double, float or real seem to work:
I get the first part (in my example 5400), but not the decimal part (,50)Could someone tell me where am i mistaking?
Here's what i do:
$prix=str_replace(" ","",$prix);
$prix=(real)$prix;
echo $prix;
->5400
Thanks.