I have an array structure of 60 elements. I'd like to use a for/foreach/while to read this structure.
This is what I have :
$this->details->field_link_01[0]['title']
$this->details->field_link_02[0]['title']
..
$this->details->field_link_60[0]['title']
And what i need is the following.
$myvar = eval ( "$this->details->field_link_" . $cont . "[0]['title']" )
What I have seen is PHP let to use $ as evaluation function
$myvar = ${"this->details->field_link_" . $cont . "[0]['title']" }
But it didn't work.
Is there any other solution ? Which PHP version ? 5.2 , 5.6 , 7 ?
Have a look at Variable variables and sprintf.