I was recently on YouTube and I noticed that did not check the shortened strings for potentially embarrassing shortenings of words.
How to make a great example?
Here is the code so you can shorten strings and check for potentially embrassing words.
<?php
// String Cleaner - Cleans words you don't want out of strings.
// Step 1 - Define the string and the words yoiu want to remove.
$string = 'this is my silly input how cool is it?';
$words_to_remove ='silly|my|eggs'; // Seperate words with | this is regular expression.
// Step 2 - shorten the string
$string = substr($string, 0, 23); // This with return the first 23 characters (including spaces) in the string.
// Step 3 - Remove the words
echo preg_replace('#\b('.$words_to_remove.')\b#is', '', $string); // This will remove the
// This would return:
// this is input
?>


