gettype

(PHP 4, PHP 5, PHP 7)

gettype锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

gettype ( mixed $var ) : string

锟斤拷锟斤拷 PHP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 var.

Warning

锟斤拷要使锟斤拷 gettype() 锟斤拷锟斤拷锟斤拷某锟斤拷锟斤拷锟酵o拷锟斤拷为锟戒返锟截碉拷锟街凤拷锟斤拷锟斤拷未锟斤拷锟侥版本锟叫匡拷锟斤拷锟斤拷要锟侥变。锟斤拷锟解,锟斤拷锟节帮拷锟斤拷锟斤拷锟街凤拷锟斤拷锟侥比较o拷锟斤拷锟斤拷锟斤拷锟斤拷也锟角斤拷锟斤拷锟侥★拷

使锟斤拷 is_* 锟斤拷锟斤拷锟斤拷锟芥。

锟斤拷锟截碉拷锟街凤拷锟斤拷锟侥匡拷锟斤拷值为锟斤拷

  • "boolean"锟斤拷锟斤拷 PHP 4 锟斤拷
  • "integer"
  • "double"锟斤拷锟斤拷锟斤拷锟斤拷史原锟斤拷锟斤拷锟斤拷锟� float 锟津返伙拷"double"锟斤拷锟斤拷锟斤拷锟斤拷"float"锟斤拷
  • "string"
  • "array"
  • "object"
  • "resource"锟斤拷锟斤拷 PHP 4 锟斤拷
  • "NULL"锟斤拷锟斤拷 PHP 4 锟斤拷
  • "user function"锟斤拷只锟斤拷锟斤拷 PHP 3锟斤拷锟斤拷锟斤拷停锟矫o拷
  • "unknown type"

锟斤拷锟斤拷 PHP 4锟斤拷锟斤拷应锟斤拷使锟斤拷 function_exists() 锟斤拷 method_exists() 取锟斤拷锟斤拷前锟斤拷 gettype() 锟斤拷锟斤拷锟节猴拷锟斤拷锟斤拷锟矫凤拷锟斤拷

锟轿硷拷 settype()锟斤拷is_array()锟斤拷is_bool()锟斤拷is_float()锟斤拷is_integer()锟斤拷is_null()锟斤拷is_numeric()锟斤拷is_object()锟斤拷is_resource()锟斤拷is_scalar() 锟斤拷 is_string()锟斤拷