-2
<?php
 $money= -20
echo money_format('%(19.2n',$money).'Only';
?>

I have tried using money_format to avoid negative sign in php,the above code removes the negative sign but it adds brackets to the given values.I want to eliminate the brackets as well as the negative sign.For instance changing -20 to 20.00.Any help on how to fix this.Thanks

4

3 回答 3

2

If you do not want negative values, don't feed negative values to money_format. Make them "unnegative" using abs.

于 2013-07-22T11:09:01.470 回答
2

Try abs().

This absolutes the value which removes negatives.

于 2013-07-22T11:09:21.337 回答
1

use abs() function which helps you to remove negatives.

于 2013-07-22T12:07:14.507 回答