Not sure if I've worded that correctly however, the below could illustrate what I'm trying to achieve better..
I have a multidimensional array where I would like to capture a specific element from the last index within an array foreach
Array:
[Something] => Array
(
[Something1] => Array
(
[0] => Array
(
[@attributes] => Array
(
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
[Something1.1] => Array
(
[Something1.1.1] => Array
(
[0] => Array
(
[DataID] => Data
[Date] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
[1] => Array
(
[DataID] => Data
[Date] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
[2] => Array (last returned)
(
[DataID] => Data
[DateLASTRETURNED] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
)
)
[Something1.2] => Array
(
[Something.1.2.1] => Array
(
[0] => Array
(
[DataID] => Data
[Date] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
[1] => Array
(
[DataID] => Data
[Date] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
[2] => Array (last returned)
(
[DataID] => Data
[DateLASTRETURNED] => YYYY-MM-DD
[DataID] => Data
[DataID] => Data
[DataID] => Data
[DataID] => Data
)
)
)
)
)
)
As you can see in brackets (last returned), I need the value within a specified element from the last returned in foreach "Something1.*) - Specifically, This field holds Date YYYY-MM-DD and would like to store into $ to reuse elsewhere.
Hopefully that makes sense, look forward to some help!
Something.1.2.1.1.1? Have you tried to write any code for this yourself? This would help give volunteers more context. Is this coming from a parsed XML document? There may be a better/earlier way to handle this task.var_export()notprint_r()so that volunteers can instantly use it. It is impossible to have duplicate keys in a given level of an array.DataIDoccurs over and over within subarrays.var_export()output AND show use the EXACT desired output that you desire from that input. Make sure that your input is sufficiently expressive of the variability of your project data.