baiju Posted October 9, 2006 Share Posted October 9, 2006 hi how to retrive a only number from string..$val='3157100325,878042,379,1';i need only numbersout shoul be 31571003258780423791;that means i need only integer valuesplease help me out Quote Link to comment Share on other sites More sharing options...
tomfmason Posted October 9, 2006 Share Posted October 9, 2006 I think that you want explode. Like this.[code=php:0]$val='3157100325,878042,379,1';$newval = explode(',', $val);[/code]Hope that helps,Tom Quote Link to comment Share on other sites More sharing options...
baiju Posted October 9, 2006 Author Share Posted October 9, 2006 that value contain not only commas may be character also will come that is problem.. Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 9, 2006 Share Posted October 9, 2006 [code]$whatever = "(123) 456-7890";$whatever_clean = preg_replace('/[^0-9]/','',$whatever);echo $whatever_clean;[/code] Quote Link to comment Share on other sites More sharing options...
brown2005 Posted October 9, 2006 Share Posted October 9, 2006 Had a look at Andy's code works fine.. ill keep it for further reference.. very useful 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.