The $ in PHP represents a variable, but what is the type of the variable to know?
Reply to discussion (solution)
PHP provides a total of six functions (they are Boolean is_int (mixed variable), Boolean is_float (mixed variable), Boolean is_bool (mixed variable), 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 ($a);
?>
PHP provides a total of six functions (they are Boolean is_int (mixed variable), Boolean is_float (mixed variable), Boolean is_bool (mixed variable), Boolean is_string (mixed variable), Boolean is_array (mixed variable), Boolean is_object (mixed variable)
But when writing PHP programs, many times, for example, will automatically change the type according to the following parameters?
<? Php
$a = 123;
$b = True;
? >
PHP is more of a time not to judge, but to convert
$a = "123";
$b = True;
Var_dump ($a * $b);
PHP provides a total of six functions (they are Boolean is_int (mixed variable), Boolean is_float (mixed variable), Boolean is_bool (mixed variable), Boolean is_string (mixed variable), Boolean is_array (mixed variable), Boolean is_object ( Mixed variable)
But when writing a PHP program, for example, does it automatically change the type according to the following parameters?
<? PHP
$a = 123;
$b = True;
? >
You're mistaken, $ is just a named symbol, he doesn't represent the type, this is the PHP specification. And the type, is your own definition.
$arr = Array ();//array
$str = ' 123 ';//String
...
PHP provides a total of six functions (they are Boolean is_int (mixed variable), Boolean is_float (mixed variable), Boolean is_bool (mixed variable), Boolean is_string (mixed variable), Boolean is_array (mixed variable), Boolean is_object (mixed variable)
But when writing PHP programs, many times, for example, will automatically change the type according to the following parameters?
<? Php
$a = 123;
$b = True;
? >
You got it wrong, $ just a named symbol, he doesn't represent the type, this is the PHP specification. And the type, is your own definition.
$arr = Array ();//arrays
$str = ' 123 ';//String
...
By the way, what does this mean? I find it difficult to find detailed information in the PHP manual, please advise.
class Foo {
Public $bar = <<
Bar
EOT;
}
?>
This is your Baidu next PHP delimiter.
In fact, should be concerned about the C parser how to know what type?
I participated in the interview of Baidu the first round of the second round has a question is asked: An array of PHP type parser how to know?