What are the advantages of using ctype_digit over strpos for numeric validation in PHP?

When validating if a string contains only numeric characters in PHP, using `ctype_digit` is more appropriate than `strpos`. `ctype_digit` checks if all characters in a string are numerical digits, while `strpos` simply searches for a substring within a string. This means `ctype_digit` ensures that the entire string consists of numeric characters, providing more accurate validation.

// Using ctype_digit for numeric validation
$input = "12345";
if (ctype_digit($input)) {
    echo "Input is numeric";
} else {
    echo "Input is not numeric";
}