fork download
  1. <?
  2. class Dummy{}
  3. class Test extends ArrayObject{
  4. public function append(Dummy $value){
  5. parent::append($value);
  6. }
  7. }
  8.  
  9. $d = new Dummy();
  10. $t = new Test();
  11. $t->append($d);
  12. //$t->append('a'); // throws error as expected
  13.  
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
object(Test)#2 (1) {
  [0]=>
  object(Dummy)#1 (0) {
  }
}