在小数点后删除十进制数字中的零

Can anyone please suggest a way to delete all zeros after the decimal point.

I need the numbers to be changed as following:

 232.20 should be converted to 232.2
 232.00 should be converted to 232
 232.22 should be the same

does number_format() help in any way?

Just use floatval( your_value )

You can use floatval():

echo floatval('12.00');
// 12

echo floatval('66.70');
// 66.7

echo floatval('44.011');
// 44.011

Simply add a zero

echo 232.20 + 0; // 232.2
echo 232.00 + 0; // 232
echo 232.22 + 0; // 232.22

I have taken reference for the SO question Remove useless zero digits from decimals in PHP

Please have a look