�]: php is numeric | easternwest.com

php is numeric

Print only numerics in string PHP?

i have a variable like this

$var=”am2c3″;

i want to print only numberics (2 and 3)

is there any function???

i am not aware if there is such function but you can however:

$var = "am2c3";
$chars = preg_split('//', $var, 0, PREG_SPLIT_NO_EMPTY);

foreach($chars as $val)
{
if(is_numeric($val))
{
print "".$val."
“;
}
}
?>

here you go fresh from my textWrangler….

powered by yahoo answers

[affmage source="amazon" results="5"]php is numeric[/affmage]

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.