PHP: Best way to check if input is a valid number? February 6, 2023 by Tarik ctype_digit was built precisely for this purpose.