retrieve interger value from string in php

by kalai 2009-04-22 19:33:10

<?php

function extintfrmstr($str){
$len = strlen($str);
for($i=0;$i<$len;$i++){
if (is_numeric($str[$i])) {
$intt .= $str[$i];
}
}

return $intt;
}


$intval= extintfrmstr('wh22oa!!11'));
echo"intval";

Output:
2211

Tagged in:

1236
like
0
dislike
0
mail
flag

You must LOGIN to add comments