PHP code example of irfanh94 / word-counter-php
1. Go to this page and download the library: Download irfanh94/word-counter-php 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/ */
irfanh94 / word-counter-php example snippets
$wordCounter = WordCounter\WordCounter::buildWithDefaults();
$numberOfWords = $wordCounter
->process("This is amazing")
->getCount(); // response: 3
$wordCounter = WordCounter\WordCounter::buildWithDefaults();
$wordCounterResponse = $wordCounter->process("This is amazing", true);
$numberOfWords = $wordCounterResponse->getCount();
$listOfWords = $wordCounterResponse->getWords();
composer