Bug #74617 [Opn->Fbk]: wordwrap ignores newlines
| From: | cmb@php.net | Date: | Sun, 21 May 2017 11:46:08 +0000 |
| Subject: | Bug #74617 [Opn->Fbk]: wordwrap ignores newlines | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209206@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74617&edit=1
ID: 74617
Updated by: cmb@php.net
Reported by: bob dot terrell at acordex dot com
Summary: wordwrap ignores newlines
-Status: Open
+Status: Feedback
Type: Bug
Package: Strings related
Operating System: Any
PHP Version: 5.6.30
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I can't reproduce the described behavior, see
<https://3v4l.org/Nm8nG>. Please provide details about
the PHP
version you are using.
Previous Comments:
------------------------------------------------------------------------
[2017-05-18 22:19:42] bob dot terrell at acordex dot com
Description:
------------
wordwrap ignores newline characters when deciding how to wrap a string.
Consider the following string:
$str = "123456789 123456789\n123 123 123";
Using wordwrap($str, 25, "\n"), you would expect two lines, as you want to wrap each line
to 25 characters.
You actually get three, because it ignores the fact that a newline exists at the 20th character, and
it wraps the string after the first "123" word.
Test script:
---------------
<?php
$str = "123456789 123456789\n123 123 123";
echo wordwrap($str, 25, "\n");
?>
Expected result:
----------------
Expected output:
123456789 123456789
123 123 123
Actual result:
--------------
Actual output:
123456789 123456789
123
123 123
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74617&edit=1