laravel/framework — pull request #1921 by driesvints (2013-07-20 16:23:27+00:00)
Title: [Proposal] Add Str Count function to determine word state

I thought of this function after running into the problem where I needed to display the phrasing of "x posts" but not knowing what x is. Of course you want "posts" to be singular when x = 1. So I added `Str::count($amount, $word)` to solve this.

```php
$amount = count($posts);
echo "$amount ".Str::count($amount, 'posts'); // Outputs "1 post" or "x posts".
```

If `$amount` is 1 then the singular version will be used and if `$amount` is anything else, the plural version of the word will be used.

Perhaps the `count` function isn't really descriptive but I couldn't think of anything else.