php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7801 Problem with arrays
Submitted: 2000-11-14 04:53 UTC Modified: 2000-11-14 05:00 UTC
From: herve at herve-thouzard Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.3pl1 OS: Windows 95 and 2000
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: herve at herve-thouzard
New email:
PHP Version: OS:

 

 [2000-11-14 04:53 UTC] herve at herve-thouzard
It's not a crash but a strange behaviour.
Try this script and look the result (below) :
<?
$MyArray[00]="00";
$MyArray[01]="01";
$MyArray[02]="02";
$MyArray[03]="03";
$MyArray[04]="04";
$MyArray[05]="05";
$MyArray[06]="06";
$MyArray[07]="07";
$MyArray[08]="08";
$MyArray[09]="09";
$MyArray[10]="10";
for($i=0;$i<11;$i++)
{
	printf("$i : %s<BR>\n",$MyArray[$i]);
}
?>

I've made my array with 0s because I've filled my indices
with UltraEdit. If I remove the unwanted 0s, everything
is ok.

Here is the result (results are worst with previous versions
of PHP 4.03 pl1) :

0 : 09
1 : 01
2 : 02
3 : 03
4 : 04
5 : 05
6 : 06
7 : 07

<b>Warning</b>:  Undefined offset:  8 in <b>bug.php</b> on line <b>15</b>
8 : 

<b>Warning</b>:  Undefined offset:  9 in <b>bug.php</b> on line <b>15</b>
9 : 
10 : 10


My php.ini is the standard distributed file.

Bye,
Herv?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-14 05:00 UTC] kir@php.net
All numbers starting with 0 are assumed octal. So there
can't be 08 and 09.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 18:02:40 2024 UTC