I am looking for the best way (fastest and saving mem) to fetch about 20 options in an addon.
In my case I need :
5 to 6 xenforo options
about 15 self created options
(3 xenforo native options are needed a couple of times and 6 selfcreated options also more than once - in for each loops for example)
I found 2 ways to do it:
Is there a ressource difference? Or is it only a semantic difference?
I somehow like the look and feel of $xenOptions['optionName']...
Anybody have any thoughts?
Luc
In my case I need :
5 to 6 xenforo options
about 15 self created options
(3 xenforo native options are needed a couple of times and 6 selfcreated options also more than once - in for each loops for example)
I found 2 ways to do it:
- getting all options at beginning of code:
$xenOptions = XenForo_Application::get('options')->getOptions();
each option will be available by calling $xenOptions['optionName']
ressources used once. but the array could be quite big, filled with options I dont need here.
- getting the options one by one:
XenForo_Application::get('options')->optionName
Thats ok, but if I have a loop like 50 times, will that take more ressources than just having the array above in 1.?
Is there a ressource change if I add a "shorthand line" at beginning of code like
$xenOptions = XenForo_Application::get('options')
and calling each option with $xenOptions->optionName?
Is there a ressource difference? Or is it only a semantic difference?
I somehow like the look and feel of $xenOptions['optionName']...
Anybody have any thoughts?
Luc