<?php
echo "<pre>";
$str = "my name is yogesh, i am great yogesh, and i am great programmer too.";
$new_arr = array_filter(preg_split('/[,. ]/',$str));
$count = array_count_values($new_arr);
arsort($count);
$sliced = array_slice($count,0,5,true);
print_r($sliced);