note 90740 added to function.print
| From: | green dot timothy dot SPAMFILTER at gmail dot com | Date: | Thu, 07 May 2009 13:32:22 +0000 |
| Subject: | note 90740 added to function.print | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154315@lists.php.net to get a copy of this message | ||
mvpetrovich, who was tired of backslashes to escape his code blocks, would probably be better served
by simply enclosing his strings in single quotes instead.
<?php
echo "<a href=\"#\" class=\"stdbutton\" style=\"float:left;\"
onclick=\"myfunction(); return false;\">My Link</a>\n";
?>
becomes
<?php
echo '<a href="#" class="stdbutton" style="float:left;"
onclick="myfunction(); return false;">My Link</a>' . PHP_EOL;
?>
Significantly easier. And also easier than using those funny quotes he chose to use. Faster code to
run, too, if that bothers you.
Actually, since I use "end of line" quite a lot for pretty-printing HTML, it's worth
defining it as something shorter:
<?php
define('CR', PHP_EOL); // carriage return
?>
----
Server IP: 193.95.141.37
Probable Submitter: 86.46.238.62
----
Manual Page -- http://www.php.net/manual/en/function.print.php
Edit -- https://master.php.net/note/edit/90740
Del: integrated -- https://master.php.net/note/delete/90740/integrated
Del: useless -- https://master.php.net/note/delete/90740/useless
Del: bad code -- https://master.php.net/note/delete/90740/bad+code
Del: spam -- https://master.php.net/note/delete/90740/spam
Del: non-english -- https://master.php.net/note/delete/90740/non-english
Del: in docs -- https://master.php.net/note/delete/90740/in+docs
Del: other reasons-- https://master.php.net/note/delete/90740
Reject -- https://master.php.net/note/reject/90740
Search -- https://master.php.net/manage/user-notes.php