Edit report at https://bugs.php.net/bug.php?id=67243&edit=1
ID: 67243
Updated by: rasmus@php.net
Reported by: elitearefin at gmail dot com
Summary: Array pointer does not work properly. I'm using
wampserver 2.5
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: windows 8.1
PHP Version: 5.5.12
Block user comment: N
Private report: N
New Comment:
A leading zero indicates an octal number. 08 and 09 are not valid octal numbers.
Previous Comments:
------------------------------------------------------------------------
[2014-05-10 17:32:48] elitearefin at gmail dot com
I'm using wampserver 2.5
------------------------------------------------------------------------
[2014-05-10 17:28:50] elitearefin at gmail dot com
Description:
------------
When using array pointer "next()" in an array like "$age =
[04,08,09,16,23,32,38,39,40,44];" or "$num = [01,02,03,04,05,06,07,08,09,10];" and
echo the result, the number "08" and "09" give "0".
Test script:
---------------
<?php
$age = [04,08,09,16,23,32,38,39,40,44];
$num = [01,02,03,04,05,06,07,08,09,10];
echo current($num) . " : " . current($age) . "<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
next($num); next($age); echo current($num) . " : " . current($age) .
"<br>";
?>
Expected result:
----------------
1 : 4
2 : 8
3 : 9
4 : 16
5 : 23
6 : 32
7 : 38
8 : 39
9 : 40
10 : 44
Actual result:
--------------
1 : 4
2 : 0
3 : 0
4 : 16
5 : 23
6 : 32
7 : 38
0 : 39
0 : 40
10 : 44
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67243&edit=1