note 36752 added to function.defined

From: Date: Tue, 21 Oct 2003 13:15:52 +0000
Subject: note 36752 added to function.defined
Groups: php.notes 
Request: Send a blank email to php-notes+get-59034@lists.php.net to get a copy of this message
Using PHP 4.3.4RC1. It should *really* be noted that if you expect that this function: <?php function safeDefine($const, $val) { if(!defined($const)) { define($const, $val); } } ?> will do what you might expect, you are wrong. I don't know if this is a bug or not, but the function that works for this example is: <?php function safeDefine($const, $val) { if(defined($const) === FALSE) { define($const, $val); } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.defined.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36752 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36752&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36752&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59034) next »