The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
Help jog this dummy's memory please
![]() Code:
Array
(
[15] => Array
(
[0] => Array
(
[id] => 2
[name] => Tim
)
[1] => Array
(
[id] => 4
[name] => karl
)
}
[18] => Array
(
[0] => Array
(
[id] => 13
[name] => max
)
}
}
I want to find out the details of the first element of the main array ( [15] ) using a foreach statement, how would I do it ? PHP Code:
However I only want (Tim and Karl printed). How can I amend the above code ? Thanks
|
|
#2
|
||||
|
||||
|
foreach() will run through each option of the array (allthough I don't think it will go into subarrays...)
If you only want to fetch the data for tim and carl, you'd have to add an if{} statement to check if the arrays key is 15. Or, in your example, just drop the first foreach and make the second into: foreach($guyscache[15] AS $value) {} |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|