Forum Moderators: coopster
I always use the if/else shorthand syntax when I can, but I've got this one line that just won't leave me alone and I can't figure out where the offending ',' is.
Here's the snippet that throws the :
echo ($i < $crumbCount)
? '<li><a class="' , $class , '" href="' , $v , '">' , $k , '</a></li>', $nl
: '<li class="' , $class , '">' , $k , '</li>', $nl;
*****
When I write it out "long-hand" like the below, no errors...
if($i < $crumbCount)
{
echo '<li><a class="' , $class , '" href="' , $v , '">' , $k , '</a></li>', $nl;
}
else
{
echo '<li class="' , $class , '">' , $k , '</li>', $nl;
}
Where am I going wrong? I can't find it.
Neophyte
replacing the commas with dots DOES work... thank you very much.
Vincevincevince -
I tried you're solution as well, but - irritatingly enough - still no dice. Strange huh? When echoing multiple components to screen I've always used commas without issue (and many people say comma echoing is faster than 'dot' echoing but I've never benchtested the two.
So, I guess for short-hand if/else representations I'll be sticking to dots.
Thanks to you both!
Neophyte