SplHeap::compare() - 数据结构
SplHeap::compare()
(PHP 5 >= 5.3.0, PHP 7)
Compare elements in order to place them correctly in the heap while sifting up
说明
abstractprotectedSplHeap::compare(mixed $value1, mixed $value2) : intCompare $value1with $value2.
WarningThrowing exceptions in SplHeap::compare() can corrupt the Heap and place it in a blocked state. You can unblock it by calling SplHeap::recoverFromCorruption(). However, some elements might not be placed correctly and it may hence break the heap-property.
参数
$value1The value of the first node being compared.
$value2The value of the second node being compared.
返回值
Result of the comparison, positive integer if $value1 is greater than $value2, 0 if they are equal, negative integer otherwise.
Note:Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position.
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!