Skip to content
Advertisement

PHP – lookup array contents with dot syntax [closed]

Does anybody see anything wrong with the following function? (Edit: no, I don’t think anything is wrong, I am just double-checking since this will be inserted into a very common code path.)

JavaScript

This will essentially convert:

JavaScript

into:

JavaScript

For context, this is for a form utility I am building in Smarty. I need the name for the form also so I need the string to be in a key-based form, and can’t directly access the Smarty variable in Smarty.

Advertisement

Answer

Try an iterative approach:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement