An easier way might be:
is_numeric(substr($string, 0, 1))
It tackles the problem of a possible empty string (that has no first character) by using substr()
. substr()
returns false
in the case of an empty string, and false
is not recognized as a number by is_numeric()
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…