假设我们有数组:
$array1 = array (
'key1' => 1,
'non1' => 1,
'key2' => 1,
'non2' => 1,
'non3' => 1,
'non4' => 1,
'key3' => 1,
'key4' => 1
);
如何移动所有具有key name
LIKE的键"key"
并将它们移动到另一个数组。
$array2 = movekey('key',$array1);
会给:
array1 = array (
'non1' => 1,
'non2' => 1,
'non3' => 1,
'non4' => 1
);
array2 = array (
'key1' => 1,
'key2' => 1,
'key3' => 1,
'key4' => 1
);