PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #20406 defined() does not work properly within function or class
Submitted:13 Nov 2002 4:39am UTC Modified: 13 Nov 2002 9:47am UTC
From:fredbird at contactoffice dot net Assigned to:
Status:Bogus Category:Variables related
Version:4.2.0 OS:Windows XP
View/Vote Developer Edit Submission

[13 Nov 2002 4:39am UTC] fredbird at contactoffice dot net
The function defined() always return false within a function or class,
although the value of the constant is still available.

the code :

<?php
define(NAME, "value");
function f() {
     if (defined(NOM)) echo "NOM is defined";
     echo NOM;
}
f();
?>

will print "value" only. Currently tested with EasyPHP running with a
Windows XP computer.
[13 Nov 2002 4:58am UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC