note 73570 added to function.print-r
| From: | mading25 at hotmail dot com | Date: | Thu, 01 Mar 2007 19:34:20 +0000 |
| Subject: | note 73570 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123993@lists.php.net to get a copy of this message | ||
None of the function to output to HTML was working for me so I had to write something that suited my
needs. It's probably super not efficient but, hey it works well for me on a small scale.
function print_r_html($data,$return_data=false)
{
$data = print_r($data,true);
$data = str_replace( " "," ", $data);
$data = str_replace( "\r\n","<br>\r\n", $data);
$data = str_replace( "\r","<br>\r", $data);
$data = str_replace( "\n","<br>\n", $data);
if (!$return_data)
echo $data;
else
return $data;
}
Simple, isn't? :)
----
Server IP: 216.235.15.211
Probable Submitter: 216.98.57.92
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/73570
Del: integrated -- https://master.php.net/note/delete/73570/integrated
Del: useless -- https://master.php.net/note/delete/73570/useless
Del: bad code -- https://master.php.net/note/delete/73570/bad+code
Del: spam -- https://master.php.net/note/delete/73570/spam
Del: non-english -- https://master.php.net/note/delete/73570/non-english
Del: in docs -- https://master.php.net/note/delete/73570/in+docs
Del: other reasons-- https://master.php.net/note/delete/73570
Reject -- https://master.php.net/note/reject/73570
Search -- https://master.php.net/manage/user-notes.php