How to change this PHP code correctly?

alfa88

New member
Having very limited PHP knowledge (basically zero), I want to change the following piece of PHP code:
$text = ($num_comments == 1) ? __('comment', 'thesis') : __('comments', 'thesis');

So, the current output of that code is: When there is 1 comment the output will be "comment".
Otherwise (with either 0 or 2+ comments) the output will be "comments" (i.e. "0 comments", "2 comments" etc.).
I need the above code changed so that when having 0 comments the output will be "comments" (as it is now). But when having 1 comment the output shall be "lonely comment" AND more importantly when having 2 or more comments the output shall be "lovely comments".

I'm sure for someone who knows PHP to change the above code line appropriately is dead easy. I just don't know enough about PHP syntax etc.
Thanks in advance!
Well, I'm looking for an *elegant* solution. (obviously)
Not for a multi-line monstrum.
Basically, the given line of code needs to be extended like this:
Right now that code says (translated into English):
"IF $num_comments = 1 THEN $text = "comment" ELSE $text = "comments"

Instead of that I need that line of code saying this:
"IF $num_comments = 0 THEN $text = "comments" and IF $num_comments = 1 THEN $text = "lonely comment" ELSE $text = "lovely comments"

So, I expect the end result to be the original line expanded by a few characters. Thanks!
@J
@Tasm
It would be great if you would actually READ what I posted. Why bother replying if you don't even read??
 
Back
Top