PHP code example of oranfry / english-lists

1. Go to this page and download the library: Download oranfry/english-lists 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/ */

    

oranfry / english-lists example snippets


use EnglishLists\EnglishLists;

$myArray = ['Blood', 'Toil', 'Tears', 'Sweat'];

echo EnglishLists::render(
    $myArray, // the array to render
    'or', // the final separator (default: and)
    false, // don't use an oxford comma (default: use oxford comma)
); // Blood, Toil, Tears or Sweat

echo EnglishLists::render(['One']); // One
echo EnglishLists::render(['One', 'Two']); // One and Two
echo EnglishLists::render(['One', 'Two', 'Three']); // One, Two, and Three