me102 Posted February 10, 2008 Share Posted February 10, 2008 Can someone tell me how to remove everything but "." and numbers. Link to comment https://forums.phpfreaks.com/topic/90389-how-to-remove-everything-but/ Share on other sites More sharing options...
Chris92 Posted February 10, 2008 Share Posted February 10, 2008 Try something like: <?php $letters = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"); $str = strtolower("WER.234.WER.werRET.4"); $string = str_replace($letters, "", $str); echo $string; //Should echo .234...4 ?> Link to comment https://forums.phpfreaks.com/topic/90389-how-to-remove-everything-but/#findComment-463422 Share on other sites More sharing options...
sasa Posted February 10, 2008 Share Posted February 10, 2008 try <?php $n = 'as3 frz8 . Ok23'; $n1 = preg_replace('/[^0-9\.]/','',$n); echo $n1; ?> Link to comment https://forums.phpfreaks.com/topic/90389-how-to-remove-everything-but/#findComment-463432 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.