May I get help to know whether this is possible?
I want to select array dynamically.
For instance,
$oj = (object)['A' => (object)['B' => (object)['C' => (object)['D' => []]]]]
$E = 'A'
$oj->$E // this will work
$E = 'A->B'
$oj->$E // this will not work
What else I can do except to write a full path? Or maybe please tell me whether this is possible or is there any example I can refer?
$oj[A][B][C][D] <---NO
$oj->A->B->C->D <---NO
$E = A->B->C->D
$oj->E <--What I want
Question Update:
$oj->E = 'Store something' <-What I want, then will store into $oj.
//So E here is not pick up the value of D, but the path of D;
Thank you very much.
$oj[A[B[C[D]]]]?