php - Handling array values using specific array element -
I have an array value like this, I tried array_search and it is no use, just what I want only The array value is to filter which is the position value. Array ([author] = & gt; Author 1 [book] = & gt; Book1 [position] => 1
array ([1] = & [2] = & gt; Array ([author] => author 2 [book] => Book2) [3] => Hey ([author] => author 3 [book] = & Gt; Book3 [status] = & gt; 1))
expected output
array ([1] => Oh ([author] = & Gt; Author 1 [Book] = & gt; Book 1 [Position] => 1] [3] => Hey ([Author] => Author 3 [Book] => Book3 [Status] = & gt; 1))
If more candidates have a proper number sequence in the output, then I would be more happy. In the above case there are two array with array number [1] and [3]. If possible, I would have to make it as [1] and [2].
Any help would be very helpful.
Thanks, Kimz
You can do this
foreach ($ my_array $ arr) {if (isset ($ arr [status']) & amp; $ arr ['position'] = '') {$ Temp_array [] = $ Arr }} Print_r ($ temp_array);
Comments
Post a Comment