![]() ![]() | ![]() |
1.1 misho 1: --TEST-- 2: SPL: ArrayObject with overriden count() 3: --FILE-- 4: <?php 5: $obj = new ArrayObject(array(1,2)); 6: var_dump(count($obj)); 7: class ArrayObject2 extends ArrayObject { 8: public function count() { 9: return -parent::count(); 10: } 11: } 12: $obj = new ArrayObject2(array(1,2)); 13: var_dump(count($obj)); 14: ?> 15: --EXPECT-- 16: int(2) 17: int(-2)