How to escape commas of monetary values in a php array?

-2

How to escape commas from monetary values in a php array? I have the array below with 12 positions but the comma that separates the decimals is giving me problems, php understands that it is a new position of the array and separates the value, how to get around it?

data: [ 0,00,
        0,00,
        0,00,
        0,00,
        0,00,
        0,00,
        0,00,
        0,00,
        2.468,00,
        2.093,00,
        600,00,
        0,00
]
    
asked by anonymous 06.11.2018 / 23:01

1 answer

-1

You can use something like:

$data = [
    '0,00',
    '0,00',
    '0,00',
    '0,00',
    '0,00',
    '0,00',
    '0,00',
    '0,00',
    '2.468,00',
    '2.093,00',
    '600,00',
    '0,00'
 ];

$valores = array_map(function($valor){
   return str_replace(",",".",str_replace(".","",$valor))
},$data);
    
07.11.2018 / 00:00