如果一个数组的元素在另一个数组中找到,则将其删除
我有一个客户端将发送的动态字符串,我想从中创建逗号分隔的标签:
$subject = "Warmly little in before cousin as sussex and an entire set Blessing it ladyship.";
print_r($tags = explode(" ", strtolower($subject)));
然而,我想删除一组特定的单词(例如定冠词),但是如果该单词在分解数组中,我想删除该单词的键和值:
$definite_articles = array('the','this','then','there','from','for','to','as','and','or','is','was','be','can','could','would','isn\'t','wasn\'t', 'until','should','give','has','have','are','some','it','in','if','so','of','on','at','an','who','what','when','where','why','we','been','maybe','further');
如果数组中的这些单词之一在数组中,请删除该单词的键和值,新数组将删除这些单词。我将使用此数组从中选择一组随机的单词。我尝试了很多事情来实现我的结果,但到目前为止还没有。有人可以帮我找到解决这个问题的方法吗?$definite_article
$tags
array_rand