array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), 'this' => array ( 0 => 'splpriorityqueue.compare.php', 1 => 'SplPriorityQueue::compare', ), 'up' => array ( 0 => 'class.splpriorityqueue.php', 1 => 'SplPriorityQueue', ), 'prev' => array ( 0 => 'class.splpriorityqueue.php', 1 => 'SplPriorityQueue', ), 'next' => array ( 0 => 'splpriorityqueue.count.php', 1 => 'SplPriorityQueue::count', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ru', 'path' => 'reference/spl/splpriorityqueue/compare.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplPriorityQueue::compare — Сравнивает приоритеты для корректного помещения элементов в очередь
Сравнивает priority1
с priority2
.
priority1
Приоритет первого узла.
priority2
Приоритет второго узла.
Результат сравнения, положительное число, когда priority1
больше priority2
, 0 если они равны, и отрицательное число
в остальных случаях.
Замечание:
При добавлении нескольких элементов с одинаковым приоритетом точный порядок следования этих элементов в очереди не определён.