mirror of
https://github.com/php/php-src.git
synced 2024-12-04 23:34:25 +08:00
22 lines
363 B
PHP
22 lines
363 B
PHP
--TEST--
|
|
SPL: SplHeap with overriden count()
|
|
--FILE--
|
|
<?php
|
|
$obj = new SplMaxHeap();
|
|
$obj->insert(1);
|
|
$obj->insert(2);
|
|
var_dump(count($obj));
|
|
class SplMaxHeap2 extends SplMaxHeap{
|
|
public function count() {
|
|
return -parent::count();
|
|
}
|
|
}
|
|
$obj = new SplMaxHeap2();
|
|
$obj->insert(1);
|
|
$obj->insert(2);
|
|
var_dump(count($obj));
|
|
?>
|
|
--EXPECT--
|
|
int(2)
|
|
int(-2)
|