note 55067 added to tutorial.useful
| From: | dont at mail dot me | Date: | Sun, 24 Jul 2005 12:48:34 +0000 |
| Subject: | note 55067 added to tutorial.useful | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92380@lists.php.net to get a copy of this message | ||
It depends on what you want to do.
Escaping in fact is a little bit faster if I'm right (which I think I am :P ),
but if you have loads of variables than heredoc might be easier to type.
However, if you have just, let's say, three variables in a long text,
you can just use escaping, e.g.
<?php
$foo1 = "whatever";
$foo2 = "You're stupid";
$foo3 = "Yes I know";
?>
<u>This</u> is a useless sentence in which I need to print <?php echo $foo; ?>
which is pretty useless actually you see? What do you say of that?<br />
<?php echo $foo2; ?><br />
Oh yeah? Well... <?php echo $foo3; ?><br />
What a piece of useless code
<?php
//more PHP code
?>
PS: More info on the heredoc syntax:
http://www.php.net/manual/en/
language.types.string.php#language.types.string.syntax.heredoc
----
Manual Page -- http://www.php.net/manual/en/tutorial.useful.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55067
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55067&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55067&report=yes
Search -- http://master.php.net/manage/user-notes.php