Reply to [PHP4] accessing constants outside class body

Your name:

Reply:


Posted by somaboy mx on 12/21/05 13:24

Is there a way to see the value of a constant that is defined outside of the
class body from within the class?

I need to do something like this, but it isn't working:

// in one file I define these settings
define('_DBUSER_', 'me');
define('_DBPASS_', 'secret');
define('_DBHOST_', 'localhost:3306');
define('_DBNAME_', 'mydb');

// then include this file in the file with the class definition
include('settings.inc');

class DBWrapper
{
var $dbuser;
var $dbpass;
var $dbhost;
var $dbname;

function DBWrapper()
{
$this->dbuser = _DBUSER_;
$this->dbpass = _DBPASS_;
$this->dbhost = _DBHOST_;
$this->dbname = _DBNAME_;
}

// ...
}


thank you,


..soma

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация