php - How to set public variable dynamically when a class instance is created
720
When I initialize a new class instance I want to set a public variable based on the current url.
How do I go about setting the public variable dynamically when the class instance is created so it is available without having to call a function.
class CONFIGURATOR{
static public $ACTIVE = true;
public $CURRENT_URL="<current_url here>"
}
Answer
Solution:
Use the constructor :
You can call your object like this :
Answer
Solution:
Use constructor , it may be solve your problem
Thank You