PHP: Reformatting Array -


help me reformat array this:

array (     [samplearr] => array         (             [0] => array                 (                     [id] => 1                 )              [1] => array                 (                     [id] => 2                 )          )  ) 

this array need reformat in above array:

array (     [samplearr] => array         (             [id] => 1             [id2] => 2         )  ) 

may can looping again array this.

$data['samplearr'] = []; foreach($data['samplearr'] $key => $value) {    $k = !empty($key) ? $key : "";    $format['samplearr'][$value['id'].$k] = $value['id']; }     

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -