Как я могу удалить слово из строки? - PullRequest
0 голосов
/ 05 мая 2011
$arr =array("Raven Lexy","rajesh123","xw2z","lolaurita","Artin");
$arrfind= Array
(
    [0] => Ohh... Perfect! You got lucky lolaurita 
    [1] => I just logged in... didn't have to make a new profile same one is stilol here whoot whoot! lolArtin 
    [2] => Hey babe, so what do you think? Have you come across any bugs? We 40 pages of bugs we are fixing which should be done in a couple of weeks, than the real marketing starts :)  
);

Я должен сопоставить вышеуказанный $ arr с каждым индексом $ arrfind и вернуть оставшуюся строку, вот так.

$arrfind [0]=>Ohh... Perfect! You got lucky 
[1]=>I just logged in... didn't have to make a new profile same one is stilol here whoot whoot! lol
[2]=>Hey babe, so what do you think? Have you come across any bugs? We 40 pages of bugs we are fixing which should be done in a couple of weeks, than the real marketing starts :)

Как я могу это сделать пожалуйста помоги, спасибо

Ответы [ 2 ]

3 голосов
/ 05 мая 2011

Используйте str_replace, который принимает массивы в качестве аргумента.В вашем случае:

str_replace( $arr, "", $arrFind );
0 голосов
/ 05 мая 2011
<?php
$result = str_replace($arr, '', $arrfind);
?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...