have this string : "5d2e1fe" and i want to get only : "521" how can i do it? thanks in advance peleg
$onlyNumbers = eregi_replace( "([a-z-])","",$str)
This is the sort of thing [man]preg_replace[/man] was invented for. preg_replace('/\D/','',$string);
chars but everyting that is not number and not only chars!
Originally posted by pelegk2 chars but everyting that is not number and not only chars!
Well you should have said you only want letters stripped. /[a-z]/i, then.