Simon Neaves was close on explaining why his function is perfect choice for testing for an int (as possibly most people would need). He made some errors on his ctype_digit() output though - possibly a typo, or maybe a bug in his version of PHP at the time.
The correct output for parts of his examples should be:
<?php
var_dump(ctype_digit(23)); var_dump(ctype_digit("23")); var_dump(ctype_digit(23.5)); var_dump(ctype_digit(NULL)); var_dump(ctype_digit("")); ?>
As you can see, the reason why using *just* ctype_digit() may not always work is because it only returns TRUE when given a string as input - given a number value and it returns FALSE (which may be unexpected).