Doc #55492 [Opn->Bgs]: about define a constant with an integers value starting with 0

From: Date: Tue, 23 Aug 2011 14:07:55 +0000
Subject: Doc #55492 [Opn->Bgs]: about define a constant with an integers value starting with 0
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7048@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55492&edit=1 ID: 55492 Updated by: bjori@php.net Reported by: kelcb at 163 dot com Summary: about define a constant with an integers value starting with 0 -Status: Open +Status: Bogus Type: Documentation Problem Package: Documentation problem Operating System: MacOS PHP Version: Irrelevant Block user comment: N Private report: N 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 http://php.net/integer Previous Comments: ------------------------------------------------------------------------ [2011-08-23 14:04:59] kelcb at 163 dot com Description: ------------ --- From manual page: http://www.php.net/function.define --- Something I found out the "hard" way today: integers starting with 0 won't work. <?php define('SOMECONSTANT', 09900); var_dump(SOMECONSTANT); ?> Produces int(0) Test script: --------------- integers starting with 0 will be handle as octal, if the value is not an valid octal value, it will return int(0) <?php define('CONS', 010); var_dump(CONS) // output int(8) define('CONS_E', 08); var_dump(CONS_E) // output int(0) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55492&edit=1

« previous php.doc.bugs (#7048) next »