How to fix error syntax error, unexpected 'if' (T_IF)?

Hello everybody! Please tell me, when using Menu::widget in one of the menu items you want to display the counter on the condition, I wrote the following:
 'label' => 'the Internet',
 'icon' => 'envelope-o',
 'url' => ['/mailbox'],
 'template'=>'<a href="{url}">{icon} {label}<span class="pull-right-container"><small class="label pull-right bg-yellow">' . if($count){echo $count}; . '</small></span></a>',

but in this case you get error ParseError syntax error, unexpected 'if' (T_IF).
April 2nd 20 at 17:30
2 answers
April 2nd 20 at 17:32">' . ($count ?: ") . '</sma....
April 2nd 20 at 17:34
if is an operator, not a function, accordingly, it does not return a value and therefore cannot concatenate.

Find more questions by tags Yii