Whats with HEREDOC all of a sudden?
Moderator: General Moderators
Whats with HEREDOC all of a sudden?
I've noticed more use of HEREDOC (especially by Nay). Personally i never use it, i prefer to jump in an out of php and leave my HTML separate.
Just wondering everyone elses thoughts.
Thanks
Mark
Just wondering everyone elses thoughts.
Thanks
Mark
-
Stoneguard
- Forum Contributor
- Posts: 101
- Joined: Wed Aug 13, 2003 9:02 pm
- Location: USA
whooohoo!
Well, I feel guilty when I leave PHP
. I never use the ?> until the end
. Well, it's just me. I don't like going in and out, I don't have a problem debugging or writing longer, as long as I don't have to exit ?>.
It's all about preference actually....
imho, heredoc is the cleverest thing PHP has ever done
haha....
well, maybe now
-Nay
Well, I feel guilty when I leave PHP
It's all about preference actually....
imho, heredoc is the cleverest thing PHP has ever done
well, maybe now
-Nay
Perl was cleverer!
you could do this
you could actually choose the symbol you wanted to use instead of the double quotes. I always used the Tilde (~) as HTML nearly never uses this symbol.
If it was like this in PHP maybe i would use it more.
Mark
It didn't matter if th
you could do this
Code: Select all
$lots_of_html = qq~anything you want here - !"(*$&^&!"$*%~;If it was like this in PHP maybe i would use it more.
Mark
It didn't matter if th
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
I almost always use heredoc for HTML because I find it easier to read especially when there's HTML in loops. I don't like having:
It's one of those personal preference things really...
Mac
Code: Select all
<?php
}
?>Mac
i use heredoc because of a function i have that will parse through the
and replace all the array keys with the array values. Its one of the best functions i have ever found. Now i didnt write this function. I believe that Celerondude did but im not too sure on that. it works so well i can always find a use for it no matter what script im writing
Code: Select all
$blah =<<<EOT;
<html>{var}</html>
EOT;