Minty Posted August 22, 2008 Share Posted August 22, 2008 I, like everyone and their mother , amd in the midst of developing my own MVC framework 'for the lulz' and, having used CakePHP, I've decided I want a 'Path.to.var' system for reading/writing/unsetting/checking Config/Session data. Examples: Config::write('Debug', 1); // should write 1 to $config['debug'] if(login check) { Session::write('User', $user); // where $user would like be a StdClass object. } echo Session::read('User.name'); // should return the value of $session['User']->name echo Config::read('Database.server'); // should return the value of $config['User']['server']; As you can see the functionality would need to include checking if the subject is an array or an object (i.e, is_object and is_array), however it needs to be 'multi-level' (i.e. Config::read('Var1.var2.var3.var4') may translate to $config['Var1']->var1['var3']->var4 if appropriate). This only needs to be possible up to, say, 4 levels. The issues I'm having with it are mainly ones resulting from references etc (i.e. how do I unset a variable with this method?). Any advice on the best way to proceed would be appreciated P.S. I don't want to 'steal' Cake's system mainly because they have a whole "Set" class built to use XPaths and all sorts which isn't something I need, I just want a lighweight "x.y.z" converter. Link to comment https://forums.phpfreaks.com/topic/120883-path-to-array-conversion/ Share on other sites More sharing options...
Minty Posted August 22, 2008 Author Share Posted August 22, 2008 No help available on this? Link to comment https://forums.phpfreaks.com/topic/120883-path-to-array-conversion/#findComment-623387 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.