note 59360 added to function.nl2br
| From: | silya at rfvnu dot lg dot ua | Date: | Sun, 04 Dec 2005 16:02:40 +0000 |
| Subject: | note 59360 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99554@lists.php.net to get a copy of this message | ||
Trouble was with file function when long tags where broken by \r\n and function strip_tags worked
not correctly with every element of array. This step prepare string from file for using function
file and then strip_tags. (For example, html file generated by M$ Word)
<?php
$str = file_get_contents($filename);
$str = str_replace("\r\n", "\n", $str);
$opentag = 0;
$nl = 0;
for($i = 0; $i < strlen($str); $i++)
{
if($opentag == 1 && $str[$i] == "\n")
{
$str[$i] = ' ';
continue;
}
if($str[$i] == '<')
$opentag = 1;
elseif($str[$i] == '>')
$opentag = 0;
else ;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59360
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59360&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59360&report=yes
Search -- http://master.php.net/manage/user-notes.php