You are here: Re: single quote in string constant « PHP Language « IT news, forums, messages
Re: single quote in string constant

Posted by Michael on 12/03/07 00:54

MangroveRoot wrote:
> - SNIP -
> (Perl, sed, TECO, and probably others
> allow the programmer to specify an alternate character
> to quote the entire string, so that ordinary single *or* double quotes
> may be used inside the string with impunity.)

echo <<<EOI
<h1><img src="_images/_rock/Zacs+World.gif" alt="{$title}"></h1>
EOI
;

You could use the heredoc syntax?

However I only recommend it when you are using many single and double
quotes. In your example your string consists of only double quotes. I
would suggest doing:

echo '<h1><img src="_images/_rock/Zacs+World.gif" alt="' . $title .
'"></h1>';

You should consider using a template engine to keep business logic and
design separate. I recommend Smarty (smarty.php.net).

- Michael

 

Navigation:

[Reply to this 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

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