PHP Escaping from HTML, faster, cleanner?!

Posted by rno on Stack Overflow See other posts from Stack Overflow or by rno
Published on 2010-04-28T13:59:38Z Indexed on 2010/04/28 14:03 UTC
Read the original article Hit count: 245

Filed under:
|
|

I've read about it from the php website (http://us3.php.net/manual/en/language.basic-syntax.phpmode.php)

Using:

echo "<html tag>" 

is slower and also annoying because you got to escape char like " with \"

But what's about using

$output = <<< EOF 
<html code>
EOF; 

Then later on in the code I can use

$output .= <<< EOF
<some more html code>
EOF; 

then when I want to print it:

echo "$output"; 

I think it's a great idea, but really wonder what you PHP guru think about it.

Cheers,

rno

© Stack Overflow or respective owner

Related posts about php

Related posts about escaping