Welcome Guest, Not a member yet? Register   Sign In
Config Static Variables Not Working
#17

(08-06-2021, 04:56 AM)MGatner Wrote: I really do not like static access from object instances, it always gets confusing (as is the case here). My advice would be to keep using the Config as you are for the object properties, but anytime you need to access the static properties just do it from the class directly:

use Config\My_config

echo My_config::$users_array[0];

I also don't like to use statics usually but in this case I am loading a couple of json files & don't wanna load again & again to avoid overhead. So the only solution is to use static variables as they maintain the state. 
While I was resolving this issue I discovered a very strange thing that some files are loaded again & again. I posted this question here https://forum.codeigniter.com/thread-79853.html.
Reply


Messages In This Thread
Config Static Variables Not Working - by myo - 08-03-2021, 06:08 AM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 08:08 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 09:56 PM
RE: Config Static Variables Not Working - by myo - 08-03-2021, 10:37 PM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 02:52 AM
RE: Config Static Variables Not Working - by myo - 08-04-2021, 09:03 AM
RE: Config Static Variables Not Working - by myo - 08-05-2021, 03:57 AM
RE: Config Static Variables Not Working - by myo - 08-06-2021, 06:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB