Something like this should do it:
$offset = 0;
while (($pos_1 = strpos($str, '<p class=', $offset)) !== false) {
$pos_2 = strpos($str, '>', $pos_1);
$sub = substr($str, $pos_1, $pos_2 - $pos_1 + 1);
$new_str = str_replace($sub, '<p>', $str);
$offset = $pos_2;
}