convert float number with comma to float in php code example
Example 1: php number format
$num = 123456.789;
echo number_format($num);
echo number_format($num, 4);
echo number_format($num, 4, '#');
echo number_format($num, 5, '#', 'T');
Example 2: number format to float php
$num = '1,200,998.255';
########## FOR FLOAT VALUES ###########################
echo filter_var($num, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
#output : 1200998.255
########## FOR INTEGER VALUES ###########################
echo filter_var($num, FILTER_SANITIZE_NUMBER_INT);
#output : 1200998