Home  >  Article  >  php教程  >  php in_array,trim,isset,unset,is_numeric函数用法。

php in_array,trim,isset,unset,is_numeric函数用法。

WBOY
WBOYOriginal
2016-06-08 17:29:401684browse

php in_array,trim,isset,unset,is_numeric函数用法。

<script>ec(2);</script>

下面我们一一看讲一下这些函数的使用教程吧。

in_array($array)

这个函数是判断当前值是否为数组哦

EX:

$array= array(1,2);
if( in_array( $array ) )
{
 die('in_array判断它是数组');
}
echo '不是数组';

result:

in_array判断它是数组


trim($value)


trim函数是去除参数的空值包括null," "

isset($value)

isset是判断变量是否存在

unset($value)

销毁变量

下面我们来看看isset,unset实例吧。

$a = 'v';

isset( $a ) ? $a:NULL;

unset( $a );

isset( $a ) ? $a:NULL;

结果是:

v

Null

is_numeric($num)

$num =3;

if( is_numeric($num) )
{
 echo $num;
}
else
{
 echo '不是数值';
}

本站原创转载注明来自www.111cn.net/phper/php.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn