gerkintrigg Posted June 2, 2006 Share Posted June 2, 2006 Hiya, could anyone tell me the best way to remove numbers from a text string please? I think it's using explode, but i don't remember the correct syntax and can't seem to find an example anywhere.The string is coming from a database (dunno if this makes a difference).thanks. Quote Link to comment https://forums.phpfreaks.com/topic/11009-removing-numbers-from-a-string/ Share on other sites More sharing options...
samshel Posted June 2, 2006 Share Posted June 2, 2006 $string = "abc123abc";$new_str = preg_replace("/[0-9]+/i","",$string);echo $new_str; Quote Link to comment https://forums.phpfreaks.com/topic/11009-removing-numbers-from-a-string/#findComment-41116 Share on other sites More sharing options...
gerkintrigg Posted June 2, 2006 Author Share Posted June 2, 2006 thanks very much ;-) Quote Link to comment https://forums.phpfreaks.com/topic/11009-removing-numbers-from-a-string/#findComment-41149 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.