I'm currently using a function to figure out if a string consists only of numbers. The function is_numeric
usually works, but if the string contains a letter, it will break. I am trying this instead:
function is_signedint($val)
{
$val = str_replace(" ", "", trim($val));
//line below is deprecated
$bool = eregi("^-?([0-9])+$",$val);
if($bool == 1)
return true;
else
return false;
}
Anyways, I was wondering how I could replace the eregi line to comply with PHP6