note 104763 added to function.define

From: Date: Wed, 06 Jul 2011 08:32:03 +0000
Subject: note 104763 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-181273@lists.php.net to get a copy of this message
To clear up a few thing: Integers with 0 in front work. But since PHP (and many other languages) handle them as octal values, they're only allowed a range of 0-7: <?php define('GOOD_OCTAL', 0700); define('BAD_OCTAL', 0800); print GOOD_OCTAL; print '<br>'; print BAD_OCTAL; ?> Result: 448 0 --------------------------------------- Furthermore, writing the constant name without the quotation-marks (as mentioned in the notes) throws an E_NOTICE and should be avoided! <?php define(TEST, 'Throws an E_NOTICE'); ?> Result: Notice: Use of undefined constant TEST - assumed 'TEST' ---- Server IP: 69.147.83.197 Probable Submitter: 109.193.185.235 ---- Manual Page -- http://www.php.net/manual/en/function.define.php Edit -- https://master.php.net/note/edit/104763 Del: integrated -- https://master.php.net/note/delete/104763/integrated Del: useless -- https://master.php.net/note/delete/104763/useless Del: bad code -- https://master.php.net/note/delete/104763/bad+code Del: spam -- https://master.php.net/note/delete/104763/spam Del: non-english -- https://master.php.net/note/delete/104763/non-english Del: in docs -- https://master.php.net/note/delete/104763/in+docs Del: other reasons-- https://master.php.net/note/delete/104763 Reject -- https://master.php.net/note/reject/104763 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181273) next »