Possibly Related:
Why don't PHP attributes allow functions?
Pardon me if this has been asked before, but why can you not have something like the following:
class foo {
require_once 'defines.php';
private $_server = DB_SERVER;
private $_username = DB_USERNAME;
private $_password = DB_PASSWORD;
private $_database = DB_NAME;
public $debug = false;
public $_conn;
function __construct() {
$connection = @mysqli_connect($this->_server, $this->_username, $this->_password, $this->_database);
}
...
}
Cheers,
EDIT: Looking to find out why this behaviour exists and why its not possible. How come the votes to close?
EDIT2 : Would also like to re-open this