php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67243 Array pointer does not work properly. I'm using wampserver 2.5
Submitted: 2014-05-10 17:28 UTC Modified: 2014-05-10 18:23 UTC
From: elitearefin at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.5.12 OS: windows 8.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
1 + 23 = ?
Subscribe to this entry?

 
 [2014-05-10 17:28 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-10 17:32 UTC] elitearefin at gmail dot com
-Summary: Array pointer does not work properly. +Summary: Array pointer does not work properly. I'm using wampserver 2.5
 [2014-05-10 17:32 UTC] elitearefin at gmail dot com
I'm using wampserver 2.5
 [2014-05-10 18:23 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2014-05-10 18:23 UTC] rasmus@php.net
A leading zero indicates an octal number. 08 and 09 are not valid octal numbers.
 [2014-05-11 09:31 UTC] elitearefin at gmail dot com
O! Thanks for quick reply..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC