php - how to get single array of comma seperate value from array -


this array want process.

array ( [0] => array ( [checklist_id] => 3 [order_id] => [id] => 1 ) [1] => array ( [checklist_id] => 4 [order_id] => [id] => 2 ) [2] => array ( [checklist_id] => 7 [order_id] => 8,9,10,11,12 [id] => 4 ) );

after trying array_push

$alreadyassingorder=array();         foreach ($collection  $checklistorder) {             if($checklistorder['order_id'])             {              $order=explode(',', $checklistorder['order_id']);               array_push($alreadyassingorder,$order);              }         } 

the output is

array ( [0] => array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) [1] => array ( [0] => 8 [1] => 9 [2] => 10 [3] => 11 [4] => 12 ) )

the output want

array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) [7] => 8 [8] => 9 [9] => 10 [10] => 11 [11] => 12 ) )

try this:

$alreadyassingorder=array();         foreach ($collection  $checklistorder) {             if($checklistorder['order_id'])             {              $order=explode(',', $checklistorder['order_id']);              foreach($order $index=>$key):                     array_push($alreadyassingorder,$key);              endforeach;              }         } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -