note 104646 added to function.define

From: Date: Tue, 28 Jun 2011 06:40:07 +0000
Subject: note 104646 added to function.define
Groups: php.notes 
Request: Send a blank email to php-notes+get-181011@lists.php.net to get a copy of this message
In response to andreas Your example define(MY_NAME, 'value'); works like this in PHP: PHP tries to find constant, and if such constant does not exist, it interprets it as a string. If such constant did exist, it would generate an error. Also, using MY_NAME for string 'MY_NAME' generates a warning. Enable all warnings and You should see it. So in general, it is best just to stick to writing strings as strings :) ---- Server IP: 69.147.83.197 Probable Submitter: 85.196.252.79 ---- Manual Page -- http://www.php.net/manual/en/function.define.php Edit -- https://master.php.net/note/edit/104646 Del: integrated -- https://master.php.net/note/delete/104646/integrated Del: useless -- https://master.php.net/note/delete/104646/useless Del: bad code -- https://master.php.net/note/delete/104646/bad+code Del: spam -- https://master.php.net/note/delete/104646/spam Del: non-english -- https://master.php.net/note/delete/104646/non-english Del: in docs -- https://master.php.net/note/delete/104646/in+docs Del: other reasons-- https://master.php.net/note/delete/104646 Reject -- https://master.php.net/note/reject/104646 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181011) next »