Duck Typing¶
In duck typing, an object is of a given type if it has all methods and properties required by that type.
<?php
interface i {
function foo() ;
}
// class X doesn't implement i, yet it is of type i because it implements foo()
class X {
function foo() {}
function bar() {}
}
?>
See also Duck Typing in PHP