我可以刪除前三個元素和其他所有value
不等於2的元素嗎?該語言是PHP。刪除陣列中的多個元素並重新索引
print_r($array)
輸出
Array (
[0] => Array ([name] => aa [value] => 0)
[1] => Array ([name] => db [value] => 1)
[2] => Array ([name] => bc [value] => 2)
[3] => Array ([name] => ba [value] => 3)
[4] => Array ([name] => ba [value] => 0)
[5] => Array ([name] => bc [value] => 1)
[6] => Array ([name] => aa [value] => 2)
[7] => Array ([name] => cb [value] => 3)
[8] => Array ([name] => ca [value] => 0)
[9] => Array ([name] => dc [value] => 1)
[10] => Array ([name] => db [value] => 2)
[11] => Array ([name] => aa [value] => 3)
[12] => Array ([name] => dd [value] => 0)
[13] => Array ([name] => db [value] => 1)
[14] => Array ([name] => bb [value] => 2)
[15] => Array ([name] => ac [value] => 3)
)
我還需要重新編制,使其從0
Array (
[0] => Array ([name] => aa [value] => 2)
[1] => Array ([name] => db [value] => 2)
[2] => Array ([name] => bb [value] => 2)
)
這將取決於在語言上。 – 2015-02-09 19:08:33
@ScottHunter。謝謝,我解決了這個問題。 – 2015-02-09 19:10:44
是的,但您必須編寫一些代碼才能執行此操作。嘗試一下,告訴我們如何去做,如果它不起作用,那麼我們可以提供幫助。 – 2015-02-09 19:21:44