GarryOne Posted October 11, 2011 Report Posted October 11, 2011 <meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8' /><?phpfunction explode_script($string, $after_word = array()) { for($i=0;$i<=count($after_word);$i++) { if(strstr($string,$after_word[$i])) { $string = explode($after_word[$i], $string); print_r($string); for($j=0;$j<=count($string);$j++) { echo $string[$j].$after_word[$i].'<br />'; } } }}$string = 'Mama mea are 4 mere. In fiecare zi merg la magazin de patru ori pe zi. Ma gandesc doar la asta. Te iubesc.';$array = array('mere.','zi.','asta');echo explode_script($string,$array);?>in for, dupa primul explode, $string deja este un array, iar a doua oara, deja nu-i mai pot face explode. Care e rezolvarea in acest caz Quote
Robert1995 Posted October 11, 2011 Report Posted October 11, 2011 Keep It Simple Stupid <?php$string = 'Mama mea are 4 mere. In fiecare zi merg la magazin de patru ori pe zi. Ma gandesc doar la asta. Te iubesc.';$delimiters = array('mere.','zi.','asta');echo str_replace($delimiters , ".<br/>" , $string);?>I want my cookies Quote