Welcome Guest, Not a member yet? Register   Sign In
how to edit
#7

[eluser]Rick Jolly[/eluser]
Yep, $id is a string. Here is a function that I use to test for an integer string:
Code:
public static function int_str($num)
{
    if ((! isset($num)) || (strval(intval($num))) !== $num))
    {
        return false;
    }

    return true;    
}
Anyone have a better method?

If you just want to test for a numeric string you can use is_numeric().


Messages In This Thread
how to edit - by El Forum - 05-27-2008, 03:47 PM
how to edit - by El Forum - 05-27-2008, 05:00 PM
how to edit - by El Forum - 05-27-2008, 10:26 PM
how to edit - by El Forum - 05-28-2008, 06:28 AM
how to edit - by El Forum - 05-28-2008, 09:07 AM
how to edit - by El Forum - 05-28-2008, 09:36 AM
how to edit - by El Forum - 05-28-2008, 10:04 AM
how to edit - by El Forum - 05-28-2008, 12:10 PM
how to edit - by El Forum - 05-28-2008, 01:13 PM
how to edit - by El Forum - 05-28-2008, 03:50 PM
how to edit - by El Forum - 05-28-2008, 04:25 PM
how to edit - by El Forum - 05-28-2008, 05:42 PM
how to edit - by El Forum - 05-28-2008, 06:28 PM
how to edit - by El Forum - 05-28-2008, 06:30 PM
how to edit - by El Forum - 05-28-2008, 08:18 PM
how to edit - by El Forum - 05-28-2008, 11:05 PM
how to edit - by El Forum - 05-28-2008, 11:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB