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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: elitearefin at gmail dot com
New email:
PHP Version: OS:

 

 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 27 04:03:38 2021 UTC