Last active
October 4, 2018 08:04
-
-
Save jagroop/074b608dea90ca1dbcc66b14f6206f17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$input = "I'm am living on india"; | |
$removeWords = [ | |
'I', | |
'on', | |
'a', | |
'without doubt' | |
]; | |
$cleanInput = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", $input))); | |
$firstCheck = preg_replace('/\b('.implode('|',$removeWords).')\b/','',$cleanInput); | |
echo $firstCheck; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment