Design patterns for PHP - visitor pattern vs servant pattern
问题 I find these two patterns are similar (and the most of other behavioral patterns) visitor pattern, interface Visitor { public function visit(Visitable $Visitable); } interface Visitable { public function accept(Visitor $Vsitor); } class ConcreteVisitable implements Visitable { public $items = array(); public function addItem($item) { $this->items[] = $item; } public function accept(Visitor $Vsitor) { $Vsitor->visit($this); } } class ConcreteVisitor implements Visitor { protected $info; public