PHP PDO's lastInsertId() method actually returns an numeric value, but it may also return something completely different like some strange SQLSTATE code or whatever. In any case it returns not a numeric value I would like to log an error. Is there a way to safely check for that?
3 Answers
is_numeric returns true for numerical strings and false otherwise. A similar function is ctype_digit.