"New" Please all phper run the following code, and then say feelings!

Source: Internet
Author: User
$arr =array (' aaa ' = ' 123234.232342 ', ' dfwee ' = ' Asdfas/2131-safa ', ' drged ' =>1234, ' kjyr ' =>1, ' bnt ' = true);                foreach ($arr as  $key = + $val) {                        echo "{$val}==1234 Resault is:". ( $val ==1234). "| | {$val}===1234 Resault is: ". ($val ===1234). "
"; }


Reply to discussion (solution)

I think you're a little confused about this.
' BNT ' =>true when output
1==1234 Resault Is:1 | | 1===1234 Resault is:

It's only true that you're showing 1.
true==1234 Resault Is:1 | | true===1234 Resault is:
Is that a little clearer?
1234 is a non-null value, Nature is logical true (true), so is:1
True===1234 Also check that the data type is consistent, obviously a logical type is inconsistent, so it is:

At output, true is printed as 1 and false is printed as null

I think you're a little confused about this.
' BNT ' =>true when output
1==1234 Resault Is:1 | | 1===1234 Resault is:

It's only true that you're showing 1.
true==1234 Resault Is:1 | | true===1234 Resault is:
Is that a little clearer?
1234 is a non-null value, Nature is logical true (true), so is:1
True===1234 Also check that the data type is consistent, obviously a logical type is inconsistent, so it is:

At output, true is printed as 1 and false is printed as null
This judgment should be similar to the Array_search function, if the third argument is not set to true, then the judgment is not valid.
So, why does the Array_search function want the third parameter optional, not the default of two parameters, and then determine the data type?!

I think you're a little confused about this.
' BNT ' =>true when output
1==1234 Resault Is:1 | | 1===1234 Resault is:

It's only true that you're showing 1.
true==1234 Resault Is:1 | | true===1234 Resault is:
Is that a little clearer?
1234 is a non-null value, Nature is logical true (true), so is:1
True===1234 Also check that the data type is consistent, obviously a logical type is inconsistent, so it is:

At output, true is printed as 1 and false is printed as null
I was array_search to harm!!!

Because PHP is weakly typed, and weak types are closer to natural languages
Not to mention the source of your own conversion data type, you do not first trouble?

Because PHP is weakly typed, and weak types are closer to natural languages
Not to mention the source of your own conversion data type, you do not first trouble?
So here's the problem, the principle of the Array_seach function should be similar to this one. Why is the third parameter optional, and if I want to search, then I have to set the third argument to true, then why not keep two parameters, the default is to determine the type?!

Do you have any array_search in your code, and how did you get killed?

Do you have any array_search in your code, and how did you get killed?
I just use the problem, just use this code to verify!!!

Strangely enough, the data from the array comes from the database or file. Naturally, the data type of each element is the same
No need to judge the type, right?

Strangely enough, the data from the array comes from the database or file. Naturally, the data type of each element is the same
No need to judge the type, right?
My is not a Web application, it seems that PHP is really not suitable for the web to think of what Ah!

  • 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.