ted_chou12 Posted February 7, 2007 Share Posted February 7, 2007 preg_replace("^[0-9]", "test", $number); this doesnt replace all the numbers in the string, can anyone help me out? Thanks Ted Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Are you looking to replace them all, no matter where they are? If so: preg_replace("[0-9]","test",$number); should do it, however that replaces each digit with test. preg_replace("[0-9]*","test",$number); will replace them all, however each bit of numbers will be replaced by test, i.e. 333 becomes test, 33a33 becomes testatest, etc. Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted February 7, 2007 Author Share Posted February 7, 2007 oh, thanks, im looking for the first one! Ted Quote Link to comment 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.