public static function main(array $args = array())
 {
     $mallard = new MallardDuck();
     $mallard->performQuack();
     $mallard->performFly();
     $model = new ModelDuck();
     $model->performFly();
     $model->setFlyBehavior(new FlyRocketPowered());
     $model->performFly();
 }
    }
}
class MallardDuck extends Duck
{
    function __construct()
    {
        $this->quackBehavior = new QuackLoud();
        $this->flyBehavior = new FlyWithWings();
    }
    public function display()
    {
        print "I'm a real Mallard duck\n";
    }
}
class ModelDuck extends Duck
{
    function __construct()
    {
        $this->flyBehavior = new FlyNoWay();
        $this->quackBehavior = new QuackLoud();
    }
    public function display()
    {
        print "I'm a model duck";
    }
}
$mallard = new MallardDuck();
$mallard->performQuack();
$mallard->performFly();
$mallard->setFlyBehavior(new FlyRocketPowered());
$mallard->performFly();