text: Program to check if input is an integer or a string | Returns true if s is a number else false ; Saving the input in a string ; Function returns 1 if all elements are in range '0-9' ; Function returns 0 if the input is not an integer
code: < ? php function isNumber ( $ s ) { for ( $ i = 0 ; $ i < strlen ( $ s ) ; $ i ++ ) if ( is_numeric ( $ s [ $ i ] ) == false ) return false ; return true ; } $ str = "6790" ; if ( isNumber ( $ str ) ) echo " Integer " ; else echo " String " ; ? >