In PHP, is it better to use is_string or is_numeric to check the type of the first character in a string?

When checking the type of the first character in a string, it is better to use is_numeric because it specifically checks if the character is a numeric value. Using is_string may return true for numeric characters as well, which can lead to incorrect results. Therefore, to accurately determine if the first character in a string is numeric, it is recommended to use is_numeric.

$string = "123abc";

if (is_numeric($string[0])) {
    echo "The first character is numeric.";
} else {
    echo "The first character is not numeric.";
}