defined() function broke?

From: Date: Fri, 06 Oct 2000 09:37:41 +0000
Subject: defined() function broke?
Groups: php.general 
Request: Send a blank email to php-general+get-18850@lists.php.net to get a copy of this message
I'm having problems with using the defined() function to check if a constant is defined. The following program: <?php echo "FOO defined: ".defined(FOO)."<br>Value: ".FOO; define("FOO", "snafu"); echo "<br><br>FOO defined: ".defined(FOO)."<br>Value: ".FOO; echo "<br><br>bar defined: ".isset($bar)."<br>Value: ".$bar; $bar = 666; echo "<br><br>bar defined: ".isset($bar)."<br>Value: ".$bar; ?> Gives the following output: FOO defined: 0 // expected Value: FOO FOO defined: 0 // broke Value: snafu bar defined: // expected Value: bar defined: 1 // expected Value: 666 Which to me seems wrong... Am I doing something dumb, or is this function broke? Environment: ========== PHP Version 4.0.2 System Linux tmt 2.2.17 #1 Tue Jul 18 17:51:27 PDT 2000 ppc unknown Build Date Sep 29 2000 Configure Command './configure' '--with-mysql' '--enable-trans-sid' '--with-apxs=/usr/local/apache/bin/apxs' '--enable-versionning' '--enable-track-vars' Server API Apache Virtual Directory Support disabled Configuration File (php.ini) Path /usr/local/lib ZEND_DEBUG disabled Thread Safety disabled -- Andy Warwick andy.w@unit5.co.uk http://www.unit5.co.uk Unit 5 Digital, 11 Ashling Court, Trent Bridge, Nottingham NG2 3JA t: +44 (0)115 986 5281 f: +44 (0)115 986 5715

« previous php.general (#18850) next »