#42213 [Opn->Bgs]: Weird integer conversion behaviour

From: Date: Sun, 05 Aug 2007 20:01:25 +0000
Subject: #42213 [Opn->Bgs]: Weird integer conversion behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115781@lists.php.net to get a copy of this message
ID: 42213 Updated by: derick@php.net Reported By: aries dot belgium at gmail dot com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: Linux PHP Version: 5.2.4RC1 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2007-08-05 19:51:30] 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) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42213&edit=1

« previous php.bugs (#115781) next »