php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42213 Weird integer conversion behaviour
Submitted: 2007-08-05 19:51 UTC Modified: 2007-08-05 20:01 UTC
From: aries dot belgium at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.2.4RC1 OS: Linux
Private report: No CVE-ID: None
 [2007-08-05 19:51 UTC] aries dot belgium at gmail dot com
Description:
------------
When placing a zero in front of a number PHP will convert it automatically to an integer value, but it becomes a zero rather than the number after the zero.

Reproduce code:
---------------
<?php
$a = intval(08);
$b = intval('08');
var_dump($a,$b,08);
?>


Expected result:
----------------
int(8) int(8) int(8)

Actual result:
--------------
int(0) int(8) int(0)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-05 20:01 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Numbers starting with a 0 are octal numbers and there is no such thing as "8" there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 04:01:32 2024 UTC