<?php phpversion() >= "7.0.0" or die(); $foo = 'foo'; $bar = new stdClass; $bar->$foo = array(10, 20, 30); // $bar->foo => array(10, 20, 30) $bar->{$foo[0]} = 42; // dynamic property $f = 42 – derived from zero offset of ‘foo’ $bar->$foo[0] = 42; // zeroth element of array that $foo identifies = 42 var_dump($bar);
You have javascript disabled. You will not be able to edit any code.