Reputation: 13
I have a number declaration
$barcode_scan = '220008100383005193';
and I want the output like this 0.519
.
I already try this code
number_format(substr($barcode_scan, -6), 0, '', '.');
but the output is 5.193
. Any help? Thanks
Upvotes: 0
Views: 60
Reputation: 1
Try with following code
number_format(substr($barcode_scan, -6)/10000, 3)
OR
number_format(substr($barcode_scan, -6)/10000, 3, '.', ',')
That is conflict of decimal point symbol and thousand separator symbol
Upvotes: 0