Dot Notation Configuration

Dot Notation Configuration

A member on a forum I frequent asked about accessing multidimensional arrays using dot notation.  The exact format he was looking for as akin to:


At least one member provided a working example, but it was sloppy.  Used globals and did no error checking.  His example, while technically valid, was prone to erring out due to undefined indices.

This was my contribution.  Does it hold any weight in terms of useful scenarios?  Maybe, maybe not.  But it was quick to write, and I suspect it’ll help the person I wrote it for.  Either way, here it is (including a code example).

The Class: Dot Notation Configuration

You’ll notice you can push arrays as deep as you wish. It doesn’t matter how you have your configuration nested, the script will be able to handle it.

Also, if you supply a file to the constructor (upon instantiation), then the file will be automatically updated upon destruction. But you also have the ability to load a configuration file, or save one, at will.

Your Feedback

Let me know in a comment below if this class has been of any help to you.  I’d love to find out what you’re using it for.  Or if you run into any problems, let me know and I’ll get them sorted out.

This script can be found on my GitHub.

Bob Hensley

IT Manager | Webmaster | Social Media Strategist | SEO Specialist | Copywriter at Fairfield's Auto Group
Bob Hensley is an IT Manager, Webmaster and all-around advertising guy by day; database theory junkie by night.Born and raised in New England, he lives just a couple hours outside of Boston with his lovely wife and one year old son.He's a technologist, and thoroughly enjoys finding new ways to use technology to better efficiency and work flows.

Latest posts by Bob Hensley (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *