note 58768 modified in function.define by nforbes

From: Date: Sat, 11 Mar 2006 00:14:28 +0000
Subject: note 58768 modified in function.define by nforbes
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-105252@lists.php.net to get a copy of this message
[Editor's Note: Obviously, constants cannot be redefined. That is the meaning of a constant.] Just a quick note.. If a constant is once defined, any subsequent attempts to define it once again are ignored. <? define('WHAT_DID_YOU_EXPECT', 'First'); define('WHAT_DID_YOU_EXPECT', 'Second'); echo WHAT_DID_YOU_EXPECT ?> Outputs 'First'. I really thought I have gone mad when I saw just the last two lines of code (the first one was in another file) and it was echoing 'First'.. --was-- Just a quick note.. If a constant is once defined, any subsequent attempts to define it once again are ignored. <? define('WHAT_DID_YOU_EXPECT', 'First'); define('WHAT_DID_YOU_EXPECT', 'Second'); echo WHAT_DID_YOU_EXPECT ?> Outputs 'First'. I really thought I have gone mad when I saw just the last two lines of code (the first one was in another file) and it was echoing 'First'.. http://php.net/manual/en/function.define.php

« previous php.notes (#105252) next »