숫자 체크 > Web 끄적임

본문 바로가기
사이트 내 전체검색

Web 끄적임

PHP 숫자 체크

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 10,615회 작성일 20-09-18 09:45

본문

$tests = array(
"42",
1337,
0x539,
02471,
0b10100111001,
1337e0,
"not numeric",
array(),
9.1,
null
);

foreach ($tests as $element) {
if (is_numeric($element)) {
echo var_export($element, true) . " is numeric", PHP_EOL;
} else {
echo var_export($element, true) . " is NOT numeric", PHP_EOL;
}
}
------------------------------------------------------------
ctype_digit() - Check for numeric character(s)
is_bool() - Finds out whether a variable is a boolean
is_null() - Finds whether a variable is NULL
is_float() - Finds whether the type of a variable is float
is_int() - Find whether the type of a variable is integer
is_string() - Find whether the type of a variable is string
is_object() - Finds whether a variable is an object
is_array() - Finds whether a variable is an array
추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

접속자집계

오늘
812
어제
1,364
최대
2,110
전체
56,815
접속자 : 2 모바일버전

Copyright © NEION All rights reserved.