<?php
$word="很长一串英文";
$total=array();
foreach(explode(" ",$word) as $v){
isset($total[$v])?$total[$v]++:$total[$v]=1;
}
foreach($total as $k=>$v){
echo $k." 出现次数 ".$v."<br>";
}
><?php
$word="很长一串英文";
$total=array();
foreach(explode(" ",$word) as $v){
isset($total[$v])?$total[$v]++:$total[$v]=1;
}
foreach($total as $k=>$v){
echo $k." 出现次数 ".$v."<br>";
}
>