Adjust currency using PHP [duplicate]

-1

I have the following value:

$ 1,524.33

I need to write to the database, in the format: 1524.33

How can I do this?

    
asked by anonymous 06.08.2017 / 21:36

1 answer

1

Use the str_replace function:

<?
    $valor_sem_ponto = str_replace(',', '.', str_replace('.', '', "1.524,33"));
    echo $valor_sem_ponto;
?>

Result

  

1524.33

    
06.08.2017 / 21:44