我正在研究 XML,我使用了 simplexml。
$xml = simplexml_load_file(a xml file); //this website is just chosen randomly
if(!in_array($iindex,$category_type)){
$category_type[] = $iindex;
$category_type[$iindex] = 1;
} else {
$category_type[$iindex] = $category_type[$iindex] + 1;
}
}
foreach($category_type as $key=> $value){
echo " number of $key is ". $value;
}
我目前得到的结果是
number of 0 is Really Funny Jokes
number of Really Funny Jokes is 13
number of 1 is Clean jokes
我期待的结果是
number of Really Funny Jokes is 13
number of Clean jokes is 6
number of Good jokes is 2
有人可以帮助我的代码吗?