/ Published in: PHP
This will count sentences that end in . or ? or ! and have a space after them.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function countSentences($str){ } countSentences("This is a test. Hey!"); // returns 2 countSentences("What do you want?"); // returns 1 // etc.