-
- $a='11';
- $b=11;
- if($a===$b)
- {
- echo 'strict equality';
- }
- else if($ a==$b)
- {
- echo 'equal';
- }
- else
- {
- echo 'not equal';
- }
Copy code
The results are equal.
Here’s how to delete elements in an array:
Examples are as follows:
- $_POST=array("firstname"=>'f',"lastname"=>'j',"email"=>"fj@qq.com", "password"=>"123",'rpassword'=>"123");
- $user=$_POST;
- function deletearray($user)
- {
- foreach($user as $key => $value )
- {
- if($key=='firstname')
- {
- unset($user[$key]);
- }
- else
- {
- return true;
- }
- }
- }
- deletearray($user);
- print_r($user);
-
Copy code
Remarks:
At first I couldn't delete firstname. I always thought it was an error with ==. Later I found out that an error occurred when calling the function. If you want to change the incoming array, you should pass in &$user. That is, pass in Only by inserting a reference can the result of the array be changed.
|