1. Define an empty array as a container,
$send _box_array = Array (
' Total ' =>0,//number of non- repeating data (total box count)
' list ' =>array ()//array with no
duplicate data (box number name)
);
2. Judging duplicate data in a cyclic search result data
The first kind: isset judgment
foreach ($result as $good _list) {
Get the total send box num
if (!isset ($send _box_array [' list '] [$good _list[' Send_box_no '])) {
$send _box_array [' Total ']++;
$send _box_array [' list '] [$good _list[' send_box_no ']] = ';
}
。。。
}
Self:: $wms _data[$num] [' user_def2 '] = $send_box_array [' Total '];
Second type: In_array ()
foreach ($result as $good _list) {
Get the total send box num
if (! In_array($good _list[' send_box_no '), $send _box_array [' list ']) {
$send _box_array [' Total ']++;
$send _box_array [' list '] [] = $good _list[' send_box_no '];
}
。。。
}
Self:: $wms _data[$num] [' user_def2 '] = $send_box_array [' Total '];
The above describes the PHP array of a field data duplication problem, including the content of data duplication, I hope the PHP tutorial interested in a friend helpful.