mirror of
https://github.com/php/php-src.git
synced 2024-12-12 03:15:29 +08:00
22 lines
391 B
PHP
22 lines
391 B
PHP
--TEST--
|
|
SPL: SplDoublyLinkedList with overriden count()
|
|
--FILE--
|
|
<?php
|
|
$obj = new SplDoublyLinkedList();
|
|
$obj[] = 1;
|
|
$obj[] = 2;
|
|
var_dump(count($obj));
|
|
class SplDoublyLinkedList2 extends SplDoublyLinkedList{
|
|
public function count() {
|
|
return -parent::count();
|
|
}
|
|
}
|
|
$obj = new SplDoublyLinkedList2();
|
|
$obj[] = 1;
|
|
$obj[] = 2;
|
|
var_dump(count($obj));
|
|
?>
|
|
--EXPECT--
|
|
int(2)
|
|
int(-2)
|