ternary operator sintax help

From: Date: Tue, 06 Oct 2009 18:43:41 +0000
Subject: ternary operator sintax help
Groups: php.general 
Request: Send a blank email to php-general+get-298682@lists.php.net to get a copy of this message
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

« previous php.general (#298682) next »