Reputation: 138
In PHP we can declare and edit variables like that,
$var = 1;
echo $var;
But PHP Fat-Free Framework has an option to declare a variable like that,
$f3->set('var', 13); //13 is a value
So my question is why it is used. There must should be a reason for making its own variable system. So what's the actuall reason? Isn't there any reason? Please someone help me because I am a newbie here.
Upvotes: 1
Views: 126
Reputation: 19662
That framework has this as a way to globally store variables without polluting the global scope itself, and while remaining bound to the instance of your app. This way, you can set and retrieve variables from the framework assuming you have a reference to the framework root object.
This is not meant to replace every variable, merely the ones you want globally available across your entire code.
Upvotes: 2