Heim  >  Artikel  >  Backend-Entwicklung  >  php如何判断数据类型?php数据类型判断函数有哪些?

php如何判断数据类型?php数据类型判断函数有哪些?

WBOY
WBOYOriginal
2016-07-25 08:51:172358Durchsuche
在php中数据类型怎么判断,php判断数据类型的常用函数有哪些,在php中判断字符串类型、数字类型、布尔类型等其它php变量类型的函数,供大家学习参考。

php判断数据类型的函数

一、php如何判断数据类型?可以使用如下函数: isset(): //变量是否已经声明 empty(): //变量是否为空 defined(): //常量是否已经定义 define() array_key_exists(mixed key, array search): //检查给定的键名或索引是否存在于数组中

is_numeric ( mixed var ): //检测变量是 否为数字或数字字符串 is_bool(): // 检测变量是否是布尔型 is_float(): // 检测变量是否是浮点型 和is_double,is_real()都一样的用法 is_int(): // 检测变量是否是整数is_integer() 一样的 用法 is_string(): // 检测变量是否是字符串 is_object(): // 检测变量是否是一个对象 is_array(): // 检测变量是否是数组 is_null(): // 检测变量是否为 NULL 值是否是NULL大小写敏感

二、php数据类型判断函数有哪些

php数据类型判断,注意is_numeric() 检测变量是否为数字或数字字符串有别 is_integer()。

常用的数据类型判断函数: is_bool()、is_float()、is_int()、is_string()、is_object()、is_array() 和 is_integer()。



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn