-3
function finderror($arg1, $arg2, $arg3) {
    ....
}

$arg1 = 054;
$arg2 = array('val1' => 12, 'val2' => 'T');
$arg3 = array('val1' => 12, 'val2' => 'T');

finderror($arg1, $arg2, $arg3);

$arg2 and $arg3 are passed as arrays. $arg1 is passed as a number. The problem is when I pass number with leading zero(054) instead of without leading zero(54), the number becomes 44 in the function. I want three number places. Whenever I add leading zero, number value change. How should I do??

1 Answers1

2

If you precede an integer value with a 0 that indicates an octal (base 8) value. In this case 054 (an octal value) is the same as 44 (decimal). See the PHP Reference

It's unclear why you need to pass three digits to your function. You could pass a three-character string: "054", or you could format the number for output in the function itself:

$arg = 54;
$output = sprintf('%03d', $arg); // "054"