3

In Perl code, you can put underscores in large numbers to improve legibility. For example, the number 123456789 is equivalent to 123_456_789, which helps the coder understand what number it represents.

Is there a character in PHP that I can use for the same purpose? I have tried commas and underscores, but neither of them work.

Ben
  • 315
  • 1
  • 3
  • 14

2 Answers2

2

Mark Baker is right, but If you strongly want

function f() {
    $f = 0;
    $args = func_get_args();
    foreach ($args as $arg) {
        $f = $f*1000+$arg;
    }
    return($f);
}

$i = f(17,123.81);
echo $i;

result 17123.81

splash58
  • 26,043
  • 3
  • 22
  • 34
1

You cannot. But why not repeat the number as a comment afterwards with commas?

Ed Heal
  • 59,252
  • 17
  • 87
  • 127