In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you about the PHP function to detect variable types of methods, the editor thinks it is very practical, so share it with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.
1. The gettype () function can get and return the type of the variable.
Echo gettype. "; echo gettype (true)."; echo gettype (''). ""; echo gettype (null). ""; echo gettype (array ()). ""; echo gettype (new stdclass ());? >
2. There are several functions in is_* series, which can be used to check the data types of variables.
Header ("Content-type:text/html;charset=utf-8"); $num1 = 123456 function dosomething = array (1, 2, 3, 4, 5, 6, 7); $bool = false;$str1 = NULL;$str2 = '654321 Taiwan float = 3.1415926 echo foo {function dosomething () {Hello! " ;} $obj = new foo (); if (is_array ($arr)) echo'$arr is an array; echo'; if (! is_array ($num1)) echo'$num1 is not an array; echo''; if (is_numeric ($str2) echo'$str2 is a number; echo'; if (is_bool ($bool) echo'$bool is a number; echo'; if (is_float ($float)) echo'$float is a floating point type; echo' If (! is_float ($str2)) echo'$str2 is not a floating point type; echo''; if (is_int ($num1)) echo'$num1 is an integer type'; echo''; if (! is_int ($float)) echo'$float is not an integer type'; echo'; if (is_string ($str2) echo'$str2 is a string'; echo''; if (is_object ($obj)) echo'$obj is an object'; echo'' If (! isset ($str1)) echo'$str1 is not defined or the value is NULL';? > above is the method of PHP function to detect variable types. Xiaobian believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.