- var_dump: documentation ( source)
- preg_split: documentation ( source)
<?php
$tests = [
'1,000.00',
'1,000.000',
'1.000,00',
'1.000,000',
'1.00',
'1.000',
'1,00',
'1,000',
];
foreach ($tests as $test) {
[$int, $sep, $dec] = preg_split('/.*\K([.,])/', $test, 3, PREG_SPLIT_DELIM_CAPTURE);
var_dump($test, $int, $sep, $dec);
echo "\n";
}