数组算法
配列
(
[0] => 配列
(
[0] => 1
[1] => 2
)
[1] => 配列
(
[0] => 2
[1] => 2
)
[2] => ; 配列
(
[0] => 1
[1] => 2
)
[3] => (
[0] => 2
[1] => 3
)
[4] => 配列
(
[0] => 3
[1] => 2
)
[5] => 配列
(
[0] => 2
[1] => 2
)
[6] => 配列
(
[0] => 2
[1] => 2
)
[7] => 配列
(
[0] => 2
[1] => 2
)
[8] => > (
[0] => 2
[1] => 2
)
[9] => 配列
(
[0] = > 3
[1] => 2
)
[10] =>配列
(
[0] => 2
[1] => 3
)
[11] =>配列
(
[0] => 20
[1] => 30
)
[12] =>配列
(
[0] => 35
[1] => 25
)
[13] =>配列
(
[0] => 100
[1] => 15
)
[14] => Array
(
[0] => 2
[1] => 1
)
)
目的:里面有重复的只保持一个,その後データはすべて唯一です。過去のものは繰り返しであると見なされ、1,2 や 2,1 も同様に動作します。
-----解解案---------
array_unique()
------解法案---------
foreach($inputarray as $value) { foreach($value as $key=>$v) { $newarray[$v] = $key;
}
}
$array = array_keys($newarray);
print_r($array);