This question already has an answer here:
Just as the title implies, I am trying to create a parser and trying to find the optimal solution to convert something from dot namespace into a multidimensional array such that
s1.t1.column.1 = size:33%
would be the same as
$source['s1']['t1']['column']['1'] = 'size:33%';
FYI In Laravel we have a
array_set()
helper function which translates in this functionMethod to store in an array using dot notation
It's simple as
You may check it in the docs
If you need to instead get the data using dot notation the process is a bit longer, but served on a plate by
array_get()
which translates to this function (actually the linked source shows you all the helper array related class)Method to read from an an array using dot notation
As you can see, it uses two submethods,
accessible()
andexists()
And