How to use A ? x:y syntax with heredoc in PHP?

Posted by wamp on Stack Overflow See other posts from Stack Overflow or by wamp
Published on 2010-06-10T04:08:02Z Indexed on 2010/06/10 4:12 UTC
Read the original article Hit count: 190

Filed under:
|
|

I tried this but only got a syntax error:

<?php

$a = true;
$str = <<< EOF
{$a ? 1 : 2}
EOF;
echo $str;

Is it possible to use such kind of conditional statement inside heredoc?

© Stack Overflow or respective owner

Related posts about php

Related posts about syntax