Wrote the code:
<?php function delete_words($text){ $str = explode(' ', $text); foreach($str as $value){ if (mb_strlen($value)>5){ unset($str[$value]); } } print_r($str); } $text = "один двадцать три сорок восемь пятдесят"; delete_words($text); ?> But he displays all the words anyway, without deleting those that are longer than 5 letters. What is wrong here?
$key => $valueand change key - Naumov