How to get value of an associative HTML array in PHP using a string?

前端 未结 3 1617
礼貌的吻别
礼貌的吻别 2021-01-29 08:19

Look I have a form like this:

I want t

3条回答
  •  借酒劲吻你
    2021-01-29 09:00

    It's hard to believe that this is a requirement. If you could expand more on what you're trying to achieve, someone undoubtedly has a better solution. However, I will ignore the eval = evil haters.

    To echo:

    eval("echo \$_POST$str;");
    

    To assign to a variable:

    eval("\$result = \$_POST$str;");
    

    If you're open to another syntax then check How to write getter/setter to access multi-level array by key names?

提交回复
热议问题