TexasMd91 Posted August 22, 2007 Share Posted August 22, 2007 I am not sure if this is simple, But how can I remove everything in a string that is not a number. Example: "f240fh02n,432534j,234l;sdcfu8904" would equal "240024325342348904" Quote Link to comment https://forums.phpfreaks.com/topic/66198-removing-everything-but-numbers-in-a-string/ Share on other sites More sharing options...
akitchin Posted August 22, 2007 Share Posted August 22, 2007 try something like this: $new_string = ereg_replace('[^0-9]', '', $old_string); writing that off the top of my head here, so it might be the incorrect param order or regex. but, theoretically, that's what you're looking for (a regex that matches anything that isn't a digit). Quote Link to comment https://forums.phpfreaks.com/topic/66198-removing-everything-but-numbers-in-a-string/#findComment-331105 Share on other sites More sharing options...
TexasMd91 Posted August 22, 2007 Author Share Posted August 22, 2007 thnx alot Quote Link to comment https://forums.phpfreaks.com/topic/66198-removing-everything-but-numbers-in-a-string/#findComment-331110 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.