> -----Original Message----- > From: Richard Ellerbrock [mailto:[EMAIL PROTECTED]] > Sent: 13 March 2002 14:25 > > The following code generates a warning when register_globals=off and > error reporting is set to E_ALL. How do I define the constant > in another > way not to generate a warning? This is with php 4.1.1. I use defines > extensively throughout my code and it is making my debugging difficult > through the transition to register_global=off code. > > <?php > > define(DBF_HOST, "localhost"); > > echo DBF_HOST; > > ?> > > Warning: Use of undefined constant DBF_HOST - assumed 'DBF_HOST' in > var/www/html/iptrackdev/test.php on line 3 localhost
That has nothing to do with register_globals! You're getting the error because you have error_reporting set to E_ALL. The error is that both arguments to define should be strings, thus: define('DBF_HOST', 'localhost'); The way you have it, the naked DBF_HOST looks like a reference to a constant, but when PHP looks it up it can't find it because it hasn't been defined yet because the define contains a reference to the constant DBF_HOST which hasn't been defined yet so when PHP looks it up it can't find it because... oh, well, you get the idea! Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php