functionlikes($names){$namesCount=count($names);if($namesCount===0){return"no one likes this";}if($namesCount===1){returnsprintf("%s likes this",$names[0]);}if($namesCount===2){returnsprintf("%s and %s like this",$names[0],$names[1]);}if($namesCount===3){returnsprintf("%s, %s and %s like this",$names[0],$names[1],$names[2]);}if($namesCount>=4){$likesStringFormat="%s, %s and %d others like this";$otherNamesCount=$namesCount-2;returnsprintf($likesStringFormat,$names[0],$names[1],$otherNamesCount);}}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is the code snippets with PHP: