Re: ternary operator in heredoc string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux