<?php
header('content-type:text/html;charset=utf-8');
//$url = "http://localhost/xiaoer/lianxi/lainxi.php";
$str = "what are you do you think why if you have one color you well have a bock what are you do you think why if you have one color you well have a bock";
//print_r($str);
$arr = explode(' ',$str);
//print_r($arr);die;
//将数组中的重复值去掉
$atr = array_unique($arr);
//print_r($atr);
//将数组重新排列为一个新的数组
$sal = array_values($atr);
//print_r($sal);
for ($i=0; $i <count($sal) ; $i++) {
$count[]=$sal[$i].'出现次数:'.substr_count($str,$sal[$i]);
}
//print_r($count);die;
?>
<center>
<table border="1">
<?php
for ($i=0; $i <count($count) ; $i++) {
echo "<tr><td>".$count[$i]."</td></tr>";
}
?>
</table>
</center>
header('content-type:text/html;charset=utf-8');
//$url = "http://localhost/xiaoer/lianxi/lainxi.php";
$str = "what are you do you think why if you have one color you well have a bock what are you do you think why if you have one color you well have a bock";
//print_r($str);
$arr = explode(' ',$str);
//print_r($arr);die;
//将数组中的重复值去掉
$atr = array_unique($arr);
//print_r($atr);
//将数组重新排列为一个新的数组
$sal = array_values($atr);
//print_r($sal);
for ($i=0; $i <count($sal) ; $i++) {
$count[]=$sal[$i].'出现次数:'.substr_count($str,$sal[$i]);
}
//print_r($count);die;
?>
<center>
<table border="1">
<?php
for ($i=0; $i <count($count) ; $i++) {
echo "<tr><td>".$count[$i]."</td></tr>";
}
?>
</table>
</center>