pastebin

Paste Search Dynamic
Recent pastes
removeZeros
  1. <?php
  2.  
  3. $arr = [
  4.     "55.100",
  5.     "55.01",
  6.     "50.001",
  7.     "50.0010",
  8.     "55.00",
  9. ];
  10.  
  11. foreach ($arr as $key => &$value) {
  12.     echo ($key + 1) . ") $value -> " . removeZeros($value) . "\r\n";
  13. }
  14.  
  15. function removeZeros($value)
  16. {
  17.     return preg_replace('/0*$/', '', $value);
  18. }
  19.  ?>
Parsed in 0.008 seconds