Page 1 of 1

Whats with HEREDOC all of a sudden?

Posted: Thu Oct 16, 2003 3:14 pm
by JayBird
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

Posted: Thu Oct 16, 2003 4:48 pm
by qads
i try not to leave php, but when it comes to big chunks of html or a part where there is no php code at all then i just switch over to HTML "mode".

Posted: Thu Oct 16, 2003 5:32 pm
by Stoneguard
Actually I tend to use heredoc style for things like long queries joining a lot of tables together. I still mix my php and HTML, though I try to keep all my solid functions up ahead of HTML and then just use PHP to format my output.

Posted: Thu Oct 16, 2003 6:02 pm
by JAM
As I mentioned in another thread; never heredoc. I find it more readable by jumping in and out of php (abit un-logical, but...).

Posted: Fri Oct 17, 2003 1:01 am
by Nay
whooohoo!

Well, I feel guilty when I leave PHP :(. I never use the ?> until the end :lol:. 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 :lol: haha....

well, maybe now 8-)

-Nay

Posted: Fri Oct 17, 2003 2:52 am
by JayBird
Perl was cleverer!

you could do this

Code: Select all

$lots_of_html = qq~anything you want here - !"(*$&^&!"$*%~;
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

Posted: Fri Oct 17, 2003 5:18 am
by volka
some of my tools fail on debugging when it comes to heredoc, therefor I seldom use it ;)

Posted: Fri Oct 17, 2003 5:30 am
by twigletmac
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:

Code: Select all

<?php
}
?>
It's one of those personal preference things really...

Mac

Posted: Fri Oct 17, 2003 9:38 pm
by Kriek
Kriek -> Steeplechaser

Inline HTML ninety-nine percent of the time.

Posted: Sat Oct 18, 2003 12:33 am
by murph
i use heredoc because of a function i have that will parse through the

Code: Select all

$blah =<<<EOT;
<html>{var}</html>
EOT;
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

Posted: Sat Oct 18, 2003 6:00 pm
by McGruff
I wouldn't use either method: instead, I'd include an html file.