hey, i have this path name from an input element interesse[angebote][flurfuerderfahrzeuge] as a string in my php var. now i need convert it somehow (with regex or explode()) so it looks like this: $_POST['interesse']['angebote']['flurfuerderfahrzeuge'] and the use eval() to get the value. But I’m sure there must be a much easier way do this.
Any ideas? Thanks!
hey, i have this path name from an input element interesse[angebote][flurfuerderfahrzeuge] as a string
Share
eval() is evil(). And there are some faster options to avoid it in this case.
If you just want to convert the syntax, then I have a regex:
If your input string not only contains the path, but also an value (attach a dummy value if you must), then you can just use parse_str() to extract the array names into a real PHP array:
Tell something more about your input data.
Okay, just figured out what you mean. You want to submerge in the $_POST array. Then use step-wise references like so: