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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 08:01:30 2024 UTC