Skip to content

Instantly share code, notes, and snippets.

@jagroop jagroop/word_removals.php
Last active Oct 4, 2018

Embed
What would you like to do?
<?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
You can’t perform that action at this time.