0
我有這個數組。最近幾個小時,我一直在嘗試循環,做出另一個將安排在各自主題的問題。在數組中循環以製作另一個數組php
[23] => Array
(
[right] => A list of station and network addresses with corresponding gateway IP address.
[id] => 23
[level] => Professional
[subject] => Array
(
[0] => Array
(
[tid] => 1
)
[1] => Array
(
[tid] => 6
)
)
[question] => What is an IP routing table?
[answer] => A list of host names and corresponding IP addresses.
[correct] => 0
)
[22] => Array
(
[right] => Session hijacking attack
[id] => 22
[level] => Professional
[subject] => Array
(
[0] => Array
(
[tid] => 1
)
[1] => Array
(
[tid] => 6
)
)
[question] => How would an IP spoofing attack be best classified?
[answer] => Session hijacking attack
[correct] => 1
)
[21] => Array
(
[right] => Repeater
[id] => 21
[level] => Intermediate
[subject] => Array
(
[0] => Array
(
[tid] => 1
)
[1] => Array
(
[tid] => 6
)
)
我想製作下面的東西。
array ([tid1] => array (
[0] array ( [question] => something)
[1] array ( [question] => somethingelse)
)
[tid2] => array (
[0] array ( [question] => something)
[1] array ( [question] => somethingelse)
)
但我無法做到這一點。做這個的最好方式是什麼?
由於看來每個問題具有多個受試者,問題會在最終數組中出現多次(每次tid下一次)? – keithhatfield 2012-02-24 20:05:01
是的。它會。我想通過tid列出問題。 – esafwan 2012-02-24 20:08:24