Here is my POST Array PHP
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
)
In the above array, I get the book_count. i.e 2 What I want to do is. There will be five array and i need to get the values of array with respect to that of book_count.
In other words - in the above case, the book count is 2, and I need to get
[book_code_1] => 230
[book_name_1] => 20
[book_code_2] => 210
[book_name_2] => 40
I need to eliminate the other array(in this case 3 to 5) values irrespective of the values. How can I achieve that?
I have tried
<?php $new_array = array_filter($_POST) ?>
but this is eliminating only the null values.