|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-10-05 09:31 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 23:00:02 2026 UTC |
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 />')); } ?>