Jump to content

Archived

This topic is now archived and is closed to further replies.

baiju

retreive integer from string

Recommended Posts

hi

how to retrive a only number from string..

$val='3157100325,878042,379,1';
i need only numbers
out shoul be 31571003258780423791;
that means i need only integer values

please help me out

Share this post


Link to post
Share on other sites
I think that you want explode. Like this.

[code=php:0]
$val='3157100325,878042,379,1';
$newval = explode(',', $val);
[/code]

Hope that helps,
Tom

Share this post


Link to post
Share on other sites
that value contain not only commas may be character also will come
that is problem..

Share this post


Link to post
Share on other sites
[code]$whatever = "(123) 456-7890";
$whatever_clean = preg_replace('/[^0-9]/','',$whatever);
echo $whatever_clean;[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.