Is there any symbol I can use to improve the clarity of the code in PHP code?
In Perl code, you can put large numbers of underscores to improve readability. For example, a number is 123456789
equivalent 123_456_789
, which helps the coder understand what number it represents.
Is there a symbol in PHP that I can use for the same purpose? I've tried commas and underscores, but none of them work.
+3
Ben
source
to share
2 answers
Mark Baker is right, but if you really want to
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
+2
splash58
source
to share
You can not. But why not repeat the number as a comment after the comma?
+1
Ed heal
source
to share