This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this function will return the plural or singular depending on the integer passed | |
//eg if $count=1 and $noun="post", it will echo 1 post..if $count!=1, it will echo X posts | |
/** | |
*@param count - Can be an integer, or a collection (which we use count() to know size) to know whether it is plural or singular | |
*@param noun - the noun to pluralize or sigularize | |
*@param return - to determine either to return it (eg when used in a controller) or echo it (default - eg used in a blade template) | |
*@param return_noun_only - when you only need the noun, and not the numeric part of it | |
*/ | |
function autoPlural($count,$noun=null,$return = false,$return_noun_only=false) |