note 74214 deleted from function.print by sobak
| From: | sobak@php.net | Date: | Sat, 10 Dec 2016 23:17:38 +0000 |
| Subject: | note 74214 deleted from function.print by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208462@lists.php.net to get a copy of this message | ||
Note Submitter: mvpetrovich
----
I grew quite tired of backslashes, and wrote these routines. It uses the back single quote as a
substitute for double quotes within a statement. It made my code much more readable. It is a
little easier than using a "here document." I also found I make a few less typing errors.
<?php
function qq($text) {return str_replace('`','"',$text); }
function printq($text) { print qq($text); }
function printqn($text) { print qq($text)."\n"; }
//example - before
echo "<a href=\"#\" class=\"stdbutton\" style=\"float:left;\"
onclick=\"myfunction(); return false;\">My Link</a>\n";
//becomes - with printqn function
printqn("<a href=
# class=stdbutton style=float:left;
onclick=myfunction(); return false;>My Link</a>");
?>