时间:2021-07-01 10:21:17 帮助过:2人阅读
foreach ($c_f_arr as &$c_f) {
if (trim($c_f[0])==trim($char)) {
echo "$char is exist
";
$c_f[1]++;
echo "hahaha
";
echo "this is cf: $c_f[1]
";
}
else {
echo "$char is not exist
";
$c_new=array(trim($char),'1');
array_push($c_f_arr, $c_new);
$n++;
}
}
$arr = array(array('a',0),array('b',0),array('c',0));
$char = 'a';
$is_exists = 0;
for($i=0,$len=count($arr); $i<$len; $i++){
if($arr[$i][0] == $char){
$arr[$i][1]++;
$is_exists = 1;
break;
}
}
if($is_exists==0){
array_push($arr, array($char,0));
}
print_r($arr);
?>