Re: ternary operator sintax help

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

 



<?= (isset($erros['anexo']) ? '<div 
class="mensagemErro">'.$erros['anexo'].'</div>' :''); ?>

""MEM"" <talofo@xxxxxxxxx> escreveu na mensagem 
002401ca46b4$ed6ad6a0$c84083e0$@com">news:002401ca46b4$ed6ad6a0$c84083e0$@com...
Hello all,

I'm trying to display a div, only when some php value is set.
Since this will be near html, I'd like to keep it on one line. So, I'd love
to use shortcuts and a ternary operator for the effect.

I'm having something like this right now, but the div still appears even if
the error is NOT set.

<?= (isset($erros['anexo'])) ? '<div class="mensagemErro">'
.$erros['anexo'].'</div>' :''; ?>

:(

Can I have your help with the right syntax ?


Regards,
The newbie on a Humpty Dumpty wall,
Márcio



-- 
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