The $ in PHP represents a variable, but what is the type of the variable to know?

Source: Internet
Author: User
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?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.