在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
<?php echo "<pre>"; $array = array(1, 1, 1, 54, 3,4, 3,4, 3, 14, 3,4, 3,7,8,9,12,45,66,5,7,8,9,2,45); $a =0; foreach ($array as $str) { @$result[$str] = $result[$str] + 1; $a = $a + 1; } echo $a; print_r($result); 25Array ( [1] => 3 [54] => 1 [3] => 5 [4] => 3 [14] => 1 [7] => 2 [8] => 2 [9] => 2 [12] => 1 [45] => 2 [66] => 1 [5] => 1 [2] => 1 )
<?php echo "<pre>"; $array = array(1, 1, 1, 54, 3,4, 3,4, 3, 14, 3,4, 3,7,8,9,12,45,66,5,7,8,9,2,45); foreach ($array as $str) { @$result[$str] = $result[$str] + 1; //$result[1] = 0 + 1; //$result[1] = 1 + 1; //$result[1] = 2 + 1; //$result[54] = 0 + 1; //$result[3] = 0 + 1; } print_r($result);
|
2022-08-18
2022-08-17
2022-08-15
2022-11-06
2022-08-17
请发表评论