/ Published in: PHP

Will strip off the decimals of a number (price) unless they are necessary.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // price(15) returns $15 // price(14.95) returns $14.95 function price($price, $decimals=null, $sign='$') { if ($decimals !== null) { } else { } } return $sign.$price; } else { } } ?>
Comments
