PHP data type conversion

1. [cast]

intval () // converted to an integer
floatval () // converted to float
bollval () // into Boolean type
strval () // convertible to a string

2. [mandatory conversion summary]

. a blank (null) is converted to the integer 0
B empty (null) is converted to floating point type float 0.
C empty (null) into a string type to the empty string '' tip:. no intervening any character or space
d. If the string behind the integer string will be retained after the digital kill
e. If the string behind the floating-point type, the latter will kill decimals string portion

3. [common] Analyzing the data type of the function

1.is_array ();
is an array
2.is_string ();
if a string
3.is_bool ();
whether the boolean
4.is_float ();
if the floating point
5.is_object ();
if the object
6. of is_int ();
if integer
7.is_numeric ();
whether the value
8. is_resource ();
if resource
9. is_null ();
if empty
10.is_acalar ();
if scalar
11. gettype ();
acquiring a data type
12. var_dump ();
output value and the types

Published 15 original articles · won praise 10 · views 576

Guess you like

Origin blog.csdn.net/weixin_44439445/article/details/102980843