Q:

convert a number to decimal number without rounding

I have this number 
$sku = '2200081005966';

and I want to convert the number like this without rounding the number
$new_sku = '5.96' 

I already try this number_format(substr($sku, 7, 12), 0, '', '.')
but the output that I get 5.97.
Any ideas how can I make this work?
Thank you.

A:

Add floor() around your number_format:
$sku = '2200081005966';
echo floor(number_format(substr($sku, 7, 12), 0, '', '.')*100)/100;

Outputs: 
5.96

Note: It would works well in case of positive numbers, your substr always take a positive number, that's why it would be enough.

