note 108457 deleted from function.print by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 16:57:37 +0000 |
| Subject: | note 108457 deleted from function.print by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187622@lists.php.net to get a copy of this message | ||
Note Submitter: @iamphilrae
----
A little improvement to the println() function from August 2008. This one includes a check to see
if the function exists (better safe than sorry should PHP include this function in the future), and
includes the ability to add blank lines to before of after the string:
if(!function_exists('println')) {
function println($string_message = '', $before=0, $after=0) {
$break = isset($_SERVER['SERVER_PROTOCOL']) ? "<br />".PHP_EOL :
PHP_EOL;
$out = '';
for(; $before>0; $before--)
$out .= $break;
$out .= $string_message.$break;
for(; $after>0; $after--)
$out .= $break;
return print($out);
}
}