#49775 [Opn->Csd]: no return in example function in note
| From: | rquadling@php.net | Date: | Mon, 05 Oct 2009 13:11:10 +0000 |
| Subject: | #49775 [Opn->Csd]: no return in example function in note | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2882@lists.php.net to get a copy of this message | ||
ID: 49775
Updated by: rquadling@php.net
Reported By: hubert at freejazz dot co dot uk
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: n/a
PHP Version: Irrelevant
New Comment:
The example in the user note has been amended to
<?php
function mynl2br($text) {
return strtr($text, array("\r\n" => '<br />', "\r" =>
'<br />', "\n"
=> '<br />'));
}
?>
Previous Comments:
------------------------------------------------------------------------
[2009-10-05 09:31:36] hubert at freejazz dot co dot uk
Description:
------------
Note #91828 Note to nl2br function entry in manual by leaf at leafo dot
net on 26-Jun-2009 08:02, there is no return statement so function does
not work
Reproduce code:
---------------
---
From manual page: function.nl2br
---
function mynl2br($text) {
strtr($text, array("\n" => '<br />', "\r\n"
=>'<br />'));
}
Expected result:
----------------
returns a string with newlines replaces by <br />s
Actual result:
--------------
returns nothing (needs a return before code on line 2 of function)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49775&edit=1