php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41274 Number 08 / 09 and 8/9 not same int's
Submitted: 2007-05-03 23:39 UTC Modified: 2007-05-03 23:56 UTC
From: cpp_pgmr at yahoo dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.2 OS: Win XP Pro / Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cpp_pgmr at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-05-03 23:39 UTC] cpp_pgmr at yahoo dot com
Description:
------------
Creating a calendar of Birthdays....
I created a multi-dimesional array with mixed data types. (Name / birthdate)
Each array had the same # of elements.

These are numbers:
For some reason, the digit 08 was not the same as 8.
Also the digit 09 was not the same as 9.

I don't know why the zero makes any difference.


See in action:  http://www.wcnet.org/~tomc83/bug.php
See source code: http://www.wcnet.org/~tomc83/bug.txt

Could not test prior than PHP 5.0.0.

Reproduce code:
---------------
<?php
	$dataAry = array(
						// Name: First, MI, Last, Birth: Mon, Day, Yr, HideAge, HidePic, ImgLoc
						//     0			1		2			3	4	5		6	7	8
						//array( 'First', 	'M', 'Last', 		02, 22, 1983, 'N', 'N', '' ),
						// --------------------------------------------------
						array( 'Kymberly',	'A', 'Brinker',		01, 06, 1984, 'N', 'N', '' ),
						array( 'Mary',		'E', 'Brinker',		02, 11, 1959, 'N', 'N', '' ),
						array( 'Thomas',    'W', 'Brinker',     08, 27, 1986, 'N', 'N', '' ),
						array( 'Daniel',	'J', 'Clark',		09, 12, 1960, 'N', 'N', '' ),
						array( 'Darin',		'J', 'Clark',		01, 02, 1965, 'N', 'N', '' ),
						array( '**1**',	'J', 'C',		08, 14, 1939, 'N', 'N', '' ),
						array( '**2**',	'J', 'C',		 8, 02, 1940, 'N', 'N', '' ),
						array( 'Thomas',	'J', 'Clark',		02, 22, 1983, 'N', 'N', '' )
					);
		foreach( $dataAry as $person )
			echo "$person[0] $person[2]  - $person[3]/$person[4]/$person[5]<BR>";

?>

Expected result:
----------------
That 08 and 8 are the same integers.

Actual result:
--------------
Treats 08 or 09 as 0, but treats 01, 02, 03...etc as 1, 2, 3.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-03 23:56 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

If you prefix a number with 0 its considered an octal number.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 14:01:32 2024 UTC