Dynamic access to a PHP array

后端 未结 4 404
逝去的感伤
逝去的感伤 2021-01-13 05:27

I tried to access with $this->$arrDataName[$key] on the element with the key $key from the array $this->$arrDataName. But PHP in

4条回答
  •  终归单人心
    2021-01-13 06:08

    Let's assume your array is $this->arrDataName. You have a $key, so your object would be $this->arrDataName[$key].

    If you want the contents of the variable which name is stored in $this->arrDataName[$key] you should do this:

    arrDataName[$key]};
    ?>
    

提交回复
热议问题