karthikeyan_coder Posted June 2, 2007 Share Posted June 2, 2007 I have a string like below. $string = "Inner peace, which is peace of mind, is not the sole possession of yogis and hermits. You too can enjoy it without becoming a yogi or a hermit. Click here to read the article." I have to replace "Click here blablab" with ""; But we cannt guess the words followed by "Click here" so i need to replace a sub string which starts with "Click here or click here" and ends with ". or !" thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/54047-string-replace-help/ Share on other sites More sharing options...
Barand Posted June 3, 2007 Share Posted June 3, 2007 if it's always the last bit $p = strpos(strtolower($string), 'click here'); $string = trim(substr($string, 0 , $p)); Quote Link to comment https://forums.phpfreaks.com/topic/54047-string-replace-help/#findComment-267204 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.