這更多的是對快速建議的要求,因爲我發現很難相信手頭沒有本地功能。考慮以下幾點:PHP數組。基於密鑰的簡單拆分
array =>
(0) => array("id" => "1", "groupname" => "fudge", "etc" => "lorem ipsum"),
(1) => array("id" => "2", "groupname" => "toffee", "etc" => "lorem ipsum"),
(2) => array("id" => "3", "groupname" => "caramel", "etc" => "lorem ipsum")
)
我所希望得到的是隻使用「組名」的新陣列,就等於:
array =>
(0) => "fudge",
(1) => "toffee",
(2) => "caramel"
)
我知道這是很容易實現的遞歸通過去原始數組,但我想知道是否有更簡單的方法來實現最終結果。我環顧四周互聯網和PHP手冊並不能發現什麼
衷心感謝你閱讀這個問題 西蒙
array_map!非常感謝你的回覆如此準時。迭代是我的意思,而不是遞歸,道歉。好東西:) – Simon
@Simon:沒問題:)快樂編碼! –