Return-1, what does that mean?
function MyFunction ($v 1, $v 2) {if ($v 1=== $v 2) {return 0;
} if ($v 1> $v 2) {return 1;
} else {return-1;
}} $a 1=array (0=> "Dog",1=> "Cat",2=> "Horse");
$a 2=array (3=> "Dog",1=> "Cat",5=> "Horse");
Print_r (ARRAY_DIFF_UASSOC ($a 1, $a 2, "myfunction"));
?>
The result of the operation is this: Array ([0] = Dog [2] = = Horse)
So the return of 0, 1,-1. I just do not understand here, has been 0, 1 of the understanding is true and false, then-1?
What's the effect of return-1? More details, please.
------Solution--------------------
The custom return value. In that function,-1 is the other condition.
------Solution--------------------
Incoming parameters $v 1, $v 2
1 means $v 1 is greater than $v 2
-1 means $v 1 is less than $v 2
0 means $v 1 equals $v 2
------Solution--------------------
Explore
Incoming parameters $v 1, $v 2
1 means $v 1 is greater than $v 2
-1 means $v 1 is less than $v 2
0 means $v 1 equals $v 2
------Solution--------------------
Custom functions, comparing index values ... That's usually the way it's written.
The 1,0,-1 here indicate greater than, equal to, less than
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.