is_numeric

Views: 7 Last modified: July 31st, 2011 Comments: 0

The function is_numeric() will check if the input is a integer or a string containing integers.

// Return: 0 (False)
echo (int)is_numeric(array());

// Return: 1 (True)
echo (int)is_numeric(551);

// Return: 1
echo (int)is_numeric(55.85);

// Return: 1
echo (int)is_numeric('6854');

// Return: 0
echo (int)is_numeric('542letters571');

// Return: 1
echo (int)is_numeric(58+36);

The result

0
1
1
1
0
1
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

    Mail this!

    To: From:Sum {1+8} =  
    Anything to add ?

        You must be logged in to post a comment.