You are here: Re: ternary operator in heredoc string « PHP « IT news, forums, messages
Re: ternary operator in heredoc string

Posted by "M. Sokolewicz" on 12/31/05 17:51

dev lamp wrote:
> Hi
>
> I am trying to use the ternary operator inside heredoc string
> to select the bgcolor based on the flag value, but it
> does not seem to work.
>
> $summary=<<<STR
> <table width=100%>
> <tr>
> <td bgcolor={$reqstat ? green : red;}>$reqno</td>
> </tr>
> </table>
> STR;
>
> I looked up php documentation but could not find any details.
>
> What would be an optimal way to write the code for the above situation ?
>
> thanks
> Dev.
$gr = $reqstat ? 'green' : 'red';
$summary=<<<STR
<table width=100%>
<tr>
<td bgcolor=$gr>$reqno</td>
</tr>
</table>
STR;

 

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

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