phorcon3 Posted July 12, 2008 Share Posted July 12, 2008 <?php $string='He is driving his car'; ?> so, what i wanna do is, find the word "is" as a whole, and delete it.. so the output should be: He driving his car what i tried is str_replace and preg_match ex: <?php echo str_replace('is','',$string); ?> but this would of course output: He driving h car does anyone know how to do this? Link to comment https://forums.phpfreaks.com/topic/114435-solved-str_replacepreg_match/ Share on other sites More sharing options...
rarebit Posted July 12, 2008 Share Posted July 12, 2008 $s = str_replace(" is ", "", $s); or $s = preg_replace('/ is /', '', $s); Link to comment https://forums.phpfreaks.com/topic/114435-solved-str_replacepreg_match/#findComment-588437 Share on other sites More sharing options...
phorcon3 Posted July 12, 2008 Author Share Posted July 12, 2008 thanks! Link to comment https://forums.phpfreaks.com/topic/114435-solved-str_replacepreg_match/#findComment-588441 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.