Reply to Re: can you use html as value for php variable

Your name:

Reply:


Posted by Rik on 04/26/07 18:09

KidBrax wrote:
> Is there a way to use html as a value for a php variable while going
> in and out of the php tag?
>
> For example, can you do something like this?
>
> <?php $strHtml = ?>
> <p>somehtml here</p>
> <?php ; ?>
>
> so that the value of $strHtml equals "<p>somehtml here</p>"
>

AFAIK, no. Which a simple test would show.
Heredoc saves a lot of escaping quotes though, if that's your problem:


$strHTML = <<<HTML
<p>someHtml here, where we dont have to worry about escaping ' and ", so
that'll just go fine. Hell, we can even use variables:
{$_SERVER['HTTP_HOST']}. The only thing that should be escaped here is
are valid variable names, so $names should be \$names.
HTML;


--
Rik Wasmus

Estimated date being able to walk again: 01-05-2007.
Less then a week, hurray!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация