note 95163 added to function.htmlspecialchars

From: Date: Wed, 16 Dec 2009 04:54:52 +0000
Subject: note 95163 added to function.htmlspecialchars
Groups: php.notes 
Request: Send a blank email to php-notes+get-164038@lists.php.net to get a copy of this message
Here's something that replicates the appearance of <pre> but still allows for word wrap: <?php function special_formatting($input) { $output = htmlspecialchars($input, ENT_QUOTES); $output = str_replace(array(' ', "\n"), array('&nbsp;&nbsp;', '<br>'), $output); return str_replace('&nbsp; ', '&nbsp;&nbsp;', $output); } ?> ---- Server IP: 117.55.229.1 Probable Submitter: 123.211.164.48 ---- Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php Edit -- https://master.php.net/note/edit/95163 Del: integrated -- https://master.php.net/note/delete/95163/integrated Del: useless -- https://master.php.net/note/delete/95163/useless Del: bad code -- https://master.php.net/note/delete/95163/bad+code Del: spam -- https://master.php.net/note/delete/95163/spam Del: non-english -- https://master.php.net/note/delete/95163/non-english Del: in docs -- https://master.php.net/note/delete/95163/in+docs Del: other reasons-- https://master.php.net/note/delete/95163 Reject -- https://master.php.net/note/reject/95163 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164038) next »