$ In php represents a variable, but how can I know the type of this variable? $ In php represents a variable, but how can I know the type of this variable?
Reply to discussion (solution)
PHP provides six functions (boolean is_int (mixed variable), boolean is_float (mixed variable), boolean is_bool (mixed variable), and boolean is_string (mixed variable), boolean is_array (mixed variable), boolean is_object (mixed variable ))
You can use the gettype () function.
$ A = "hello ";
Echo gettype ($ );
?>
PHP provides six functions (boolean is_int (mixed variable), boolean is_float (mixed variable), boolean is_bool (mixed variable), and boolean is_string (mixed variable), boolean is_array (mixed variable), boolean is_object (mixed variable ))
However, when writing a php program, for example, is the type automatically changed based on the following parameters?
<? Php
$ A = 123;
$ B = True;
?>
Php is more time-consuming than judgment, but conversion.
$ A = "123 ";
$ B = True;
Var_dump ($ a * $ B );
PHP provides six functions (boolean is_int (mixed variable), boolean is_float (mixed variable), boolean is_bool (mixed variable), and boolean is_string (mixed variable), boolean is_array (mixed variable), boolean is_object (mixed variable ))
However, when writing a php program, for example, is the type automatically changed based on the following parameters?
<? Php
$ A = 123;
$ B = True;
?>
You are mistaken. $ is just a named symbol and does not represent the type. this is the PHP specification. The type is defined by yourself.
$ Arr = array (); // array
$ Str = '000000'; // string
...
PHP provides six functions (boolean is_int (mixed variable), boolean is_float (mixed variable), boolean is_bool (mixed variable), and boolean is_string (mixed variable), boolean is_array (mixed variable), boolean is_object (mixed variable ))
However, when writing a php program, for example, is the type automatically changed based on the following parameters?
<? Php
$ A = 123;
$ B = True;
?>
You are mistaken. $ is just a named symbol and does not represent the type. this is the PHP specification. The type is defined by yourself.
$ Arr = array (); // array
$ Str = '000000'; // string
...
By the way, what does this mean? It is difficult for me to find detailed information in the php Manual. please give me some advice.
Class foo {
Public $ bar = < Bar
EOT;
}
?>
This is your keyword for PHP under Baidu.
In fact, we should be more concerned about how the c parser knows what type?
I have participated in Baidu's interview. after the first round, I had a question in the second round: How do I know an array php parser?