Hey, not quite sure on this but ... $url = '/joke/' . $row['joke_id'] . '-' . strtolower(str_replace('--', '-', str_replace(' ', '-', preg_replace('/[^\sA-Za-z0-9]+/', '', substr($row['joke_content'], 0, 60))))) . '.html'; echo $url; PHP: Now, when the $url is echoed, it's showing this: /joke/152-why-were-ancient-egyptian-children- confused- because-t.html I don't see where them extra spaces are coming from... When $row['joke_content'] is echoed, this is shown: Why were ancient Egyptian children confused? Because their daddies were mummies. Perfect, but in the source this is shown: Why were ancient Egyptian children confused? Because their daddies were mummies. So, for some reason them extra lines are coming from no where, this seems to be the case with most jokes in the database, is there anything I can do to get rid of these new lines when echoing and also in the $url? Thanks
hi try this $text=preg_replace("/[rn]+[st]*[rn]+/","n",$row['joke_content']); $url = '/joke/' . $row['joke_id'] . '-' . strtolower(str_replace('--', '-', str_replace(' ', '-', preg_replace('/[^\sA-Za-z0-9]+/', '', substr($text, 0, 60))))) . '.html';echo $url; Regards Alex