Code given below is taken from the stackoverflow.com !!! Can anyone tell me how to get the array elements order by decreaseing or increasing !! plz help me !!! Thanks in advance
$contents = file_get_contents($htmlurl);
// Get rid of style, script etc
$search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<head>.*?</head>@siU', // Lose the head section
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$contents = preg_replace($search, '', $contents);
$result = array_count_values(
str_word_count(
strip_tags($contents), 1
)
);
print_r($result);
You need PHP’s sort function. I won’t duplicate the manual here.