0
這是帖子陣列PHP處理POST ARRAY和array_filter
Array
(
[book_count] => 2
[book_code_1] => 230
[book_name_1] => 20
[book_code_2] => 210
[book_name_2] => 40
[book_code_3] =>
[book_name_3] => 60
[book_code_4] =>
[book_name_4] => 80
[book_code_5] =>
[book_name_5] => 90
)
在上面的陣列中,我得到的共BOOK_COUNT。即2 我想要做的是。 將有五個數組,我需要得到相對於book_count數組的值。
換言之 - 在上述情況下,書數爲2,並且我需要得到
[book_code_1] => 230
[book_name_1] => 20
[book_code_2] => 210
[book_name_2] => 40
我需要不論消除另陣列(在這種情況下3至5)的值值。我怎樣才能做到這一點?
我已經試過
<?php $new_array = array_filter($_POST) ?>
但這只是消除了空值。
通過你的數組循環var –
你可以做那簡單的迭代。看到我的答案和演示[這裏](http://stackoverflow.com/questions/24155952/handling-post-array-in-php-and-array-filter/24156161#24156161) –
huseyin - yup,投了你的答案。謝謝 – user3350885