note 46722 added to function.str-replace

From: Date: Thu, 21 Oct 2004 11:20:41 +0000
Subject: note 46722 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-78875@lists.php.net to get a copy of this message
After banging my head against a wall trying to strip line breaks from text coming from mysql using the following $remark = str_replace('<br>', ' ', trim($remark)); $remark = str_replace('\r', '', str_replace('\n', '', $remark)); I discovered that it just does not work, no matter how I wrote it. I then found the following which DOES strip out the line breaks $remark = eregi_replace("\n"," ",eregi_replace("\r"," ",strip_tags(trim(nl2br($remark))))); - this is on a windows box. ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46722 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46722&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46722&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78875) next »