php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23379 comparing "08" and "09" with 08 and 09 returns false
Submitted: 2003-04-28 04:09 UTC Modified: 2003-04-28 04:33 UTC
From: oli dot brouckaert at i-services dot be Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.0 OS: Windows XP
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: oli dot brouckaert at i-services dot be
New email:
PHP Version: OS:

 

 [2003-04-28 04:09 UTC] oli dot brouckaert at i-services dot be
Hello

I've found a strange bug :

<?php
$string="01"; // and "02", "03", ... except "08" and "09"

echo ($string == 01)?1:0; // shows 1

$string="08"; // also for "09" but not other numbers

echo ($string == 08)?1:0; // shows 0
?>

Olivier

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-28 04:33 UTC] edink@php.net
Numbers with leading zeros are considered octal where 08 and 09 are not allowed (and therefore evaluated as 0).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 17:01:28 2025 UTC