tags:

views:

81

answers:

3

Hello !

When I try to cast

$value = floatval('14,5833');

to a float type I expect a value with dot like 14.5833 but it returns me 14,5833.

How should I do this ?

I wouldn't like to use any string replace functions.

A: 

Check decimal_point from localeconv and setlocale

bogdanvursu
+2  A: 

You have two options:

  • Set locale to something that uses a dot instead of a coma. E.g. setLocale(LC_ALL, 'fr_BE.UTF-8');
  • Keep using comma internally, and when you want to output that number, use number_format
A: 

do strreplace(. Y . )

jaij