0

I have an php array having arguments with Zerofill values like..

$a = (00001, 00008, 00009, 00012);

When I am using this array as parameter of a function, then it giving unexpected results, like...

print_r($a); //prints

array  ( [0]=>1  [1]=>0  [2]=>0  [3]=>1 )

Why? and how will we counter this error???

santoshe61
  • 805
  • 8
  • 17

2 Answers2

-1

Try this

$a = array('00001', '00008', '00009','00012');
paranoid
  • 6,799
  • 19
  • 49
  • 86
-1

Numbers with leading zero are the octal notation. If you need to prepend numbers by leading zeros you can use string functions.

Community
  • 1
  • 1
Timurib
  • 2,735
  • 16
  • 29