PHP code example of mmucklo / inflect

1. Go to this page and download the library: Download mmucklo/inflect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mmucklo / inflect example snippets


use Inflect\Inflect;

Inflect::pluralize('test');        // 'tests'
Inflect::singularize('tests');     // 'test'
Inflect::pluralizeIf(1, 'cat');    // '1 cat'
Inflect::pluralizeIf(3, 'person'); // '3 people'

Inflect::pluralize('Man');         // 'Men'
Inflect::pluralize('datum');       // 'data'
Inflect::pluralize('news');        // 'news'
Inflect::singularize('criteria');  // 'criterion'
Inflect::singularize('Children');  // 'Child'

// Double-inflection is a no-op:
Inflect::pluralize('people');      // 'people'
Inflect::singularize('datum');     // 'datum'