我有下面的一組陣列的一個ORM查詢返回在PHP重建索引陣列基於數據庫的主鍵ID
array(
(int) 0 => array(
(int) 0 => array(
'id' => '11',
'name' => 'branch11',
'code' => '018',
'server_name' => '****',
'user_name' => 'usr1',
'pass_name' => '***',
'database_name' => '***',
'sct_mapping_code' => '318'
)
),
(int) 1 => array(
(int) 0 => array(
'id' => '12',
'name' => 'Branch1',
'code' => '001',
'server_name' => 'SRVR1',
'user_name' => '****',
'pass_name' => '****',
'database_name' => '***',
'mapping_code' => '301'
)
)
)
我需要改變它低於
array
('11'=> array(
'name' => 'branch11',
'code' => '018',
'server_name' => '****',
'user_name' => 'usr1',
'pass_name' => '***',
'database_name' => '***',
'sct_mapping_code' => '318'
),
'12'=>array(
'name' => 'Branch1',
'code' => '001',
'server_name' => 'SRVR1',
'user_name' => '****',
'pass_name' => '****',
'database_name' => '***',
'mapping_code' => '301'
)
)
我需要做id => 11和id => 12作爲新陣列的索引
使用循環和重新分配新的關鍵 –