PHP code example of vanderlee / php-sentence
1. Go to this page and download the library: Download vanderlee/php-sentence 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/ */
vanderlee / php-sentence example snippets
// This is the test text we're going to use
$text = "Hello there, Mr. Smith. What're you doing today... Smith,"
. " my friend?\n\nI hope it's good. This last sentence will"
. " cost you $2.50! Just kidding :)";
// Create a new instance
$Sentence = new \Sentence;
// Split into array of sentences
$sentences = $Sentence->split($text);
// Count the number of sentences
$count = $Sentence->count($text);