对变量进行单数或复数设置.PHP

Tho*_*wes 2 php variables singular

有许多问题解释如何回应单数或复数变量,但没有人回答我的问题,即如何设置变量以包含所述单数或复数值.

我原以为它会起作用如下:

$bottom="You have favourited <strong>$count</strong> " . $count == 1 ? 'user':'users';
Run Code Online (Sandbox Code Playgroud)

然而,这不起作用.

有人可以建议我如何实现上述目标吗?

and*_*sme 5

这将解决您的问题,感谢mario和Ternary运算符和字符串连接的怪癖?

$bottom = "You have favourited <strong>$count</strong> " . ($count == 1 ? 'user':'users');
Run Code Online (Sandbox Code Playgroud)