| 
<?php 
 echo "<pre>";
 print_r(myexplode('Иванов Иван Васильевич Профессор археологии',' ',3));
 echo "</pre>";
 
 echo "<br><br>".myimplode('-=-',array('Новости','Услуги','Прайс-лист','Контакты','Проекты','Клиенты'));
 
 function myexplode($str,$chr,$limit=0)
 {
 if($chr == '') return false;
 
 $res = array();
 $point = 0;
 $res[0] = '';
 
 for($a=0;$a<=strlen($str);$a++)
 {
 if($str{$a} == $chr && $limit && $point+1<$limit)
 $res[++$point] = '';
 else
 $res[$point] .= $str{$a};
 }
 
 return $res;
 }
 
 function myimplode($glue,$array)
 {
 $res = '';
 $cnt = count($array)-1;
 
 for($a=0;$a<$cnt;$a++)
 $res .= $array[$a].$glue;
 
 return $res.$array[$cnt];
 }
 
 ?>
 |