jamesxg1 Posted March 27, 2010 Share Posted March 27, 2010 Hiya peeps, I'm totally lost here I just cant figure it out. This is what I need to do. $input = 'hiya how are you doing today'; $match = array('how are you'); // foreach check if 'how are you' is in $input. // if it is remove it from the string a send the rest to $this->output('THE REST OF THE STRING'); // if it doesnt match then call $this->conversate_word($input); Many thanks James. Link to comment https://forums.phpfreaks.com/topic/196668-match-remove-from-string-help/ Share on other sites More sharing options...
premiso Posted March 27, 2010 Share Posted March 27, 2010 foreach ($match as $string) { if (stristr($string, $input) !== false) { $input = str_replace($string, "", $input); } } echo $input; Link to comment https://forums.phpfreaks.com/topic/196668-match-remove-from-string-help/#findComment-1032555 Share on other sites More sharing options...
jamesxg1 Posted March 27, 2010 Author Share Posted March 27, 2010 foreach ($match as $string) { if (stristr($string, $input) !== false) { $input = str_replace($string, "", $input); } } echo $input; Hiya bud, Cheers for the reply mate, it didnt work :S. Many many thanks James Link to comment https://forums.phpfreaks.com/topic/196668-match-remove-from-string-help/#findComment-1032557 Share on other sites More sharing options...
jamesxg1 Posted March 27, 2010 Author Share Posted March 27, 2010 BUMP. Link to comment https://forums.phpfreaks.com/topic/196668-match-remove-from-string-help/#findComment-1032563 Share on other sites More sharing options...
premiso Posted March 27, 2010 Share Posted March 27, 2010 Figure it out for yourself, this nonsense of "it does not work" is just bs. Flipping the $string and $input should make it work, which you could have found out by reading the manual for stristr as well which would have helped you out. How do you think everyone here who answers questions know how to do it? The learned it by reading, trying and failing. If you do not want to code it yourself then don't. Find someone else to code it and pay them. If you do, read and try stuff out for yourself. Link to comment https://forums.phpfreaks.com/topic/196668-match-remove-from-string-help/#findComment-1032585 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.