I’m really new to OOP. I’m even not a newbie – I’m noob. So. I want to transfer my pseudo-CMS from “normal” programming, into OOP programming system. And so:
private static $dsn = DB_TYPE.':host='.DB_HOST.';dbname='.DB_NAME;
What here causes problem? Usage of constraints? I don’t know. My editor (aptana studio) shows error after 1 constant. Thanks
Edit:
Thanks for fast reaction. I’ll do it in contructor.
Edit2:
But what if i want to use singleton? How to pass arguments to contructor?
See the documentation:
You cannot concatenate strings when defining class properties.
Example from the documentation (for completness):
As you switch to OOP anyway you should not use constants. Pass those values to the constructor of your class: