mcaskill/php-get-var-type
Composer 安装命令:
composer require mcaskill/php-get-var-type
包简介
Get the type, resource name, or class name of a variable.
关键字:
README 文档
README
(PHP 5 >= 5.4)
get_var_type — Get the type, resource name, or class name of a variable.
Description
string get_var_type( mixed &$var )
Returns the type (name if an object or resource) of the PHP variable var.
Based on Pavel Lang's get_type() function.
Parameters
var— The variable being type checked.
Return Values
If the given var is:
- a resource, this function will return the value from
get_resource_type() - an object, this function will return the value from
get_class() - else, this function will return the value from
gettype()
Examples
Example #1 get_var_type() example
$data = array(1, 1., NULL, new ArrayIterator, 'foo', mysql_connect());
foreach ($data as $value) {
echo gettype($value), "\n";
}
The above example will output something similar to:
integer
double
NULL
ArrayIterator
string
mysql link
Installation
With Composer
$ composer require mcaskill/php-get-var-type
Without Composer
Why are you not using composer? Download Function.Fallback.php from the gist and save the file into your project path somewhere.
统计信息
- 总下载量: 10.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-23