$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!