the-botman Posted October 4, 2012 Share Posted October 4, 2012 ok see i am trying to remove the number 16 , it removes the number but also removes it from the time which is wrong for example 16:45 , i just want it to remove the number 16 if its alone and not if it has : next to it this is what im using $FGuide = str_replace("16", '', $FGuide); thanks in advance zainul Quote Link to comment https://forums.phpfreaks.com/topic/269076-str_replace-help/ Share on other sites More sharing options...
Christian F. Posted October 4, 2012 Share Posted October 4, 2012 For this you'll need to use RegExps, or at least if the number can appear with anything other than just spaces on either side. The RegExp variant: $FGuide = preg_replace ('/\\b16(?![:\\d])/', '', $FGuide); That'll remove any number 16 which is not followed by a semi colon or another digit. Quote Link to comment https://forums.phpfreaks.com/topic/269076-str_replace-help/#findComment-1382681 Share on other sites More sharing options...
the-botman Posted October 4, 2012 Author Share Posted October 4, 2012 thanks alot that was really a great help Quote Link to comment https://forums.phpfreaks.com/topic/269076-str_replace-help/#findComment-1382689 Share on other sites More sharing options...
Christian F. Posted October 4, 2012 Share Posted October 4, 2012 You're welcome, glad I could help. Quote Link to comment https://forums.phpfreaks.com/topic/269076-str_replace-help/#findComment-1382691 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.