> Design Patterns > Visitor > Visitor Design Pattern In PHP

Visitor Design Pattern In PHP

Visitor design pattern in PHP to perform operation on elements of an object structure.


Visitor design pattern In PHP

Output

ConcreteElementA::Accept()
ConcreteVisitor1::VisitConcreteElementA()
ConcreteElementA::Accept()
ConcreteVisitor2::VisitConcreteElementA()
ConcreteElementB::Accept()
ConcreteVisitor1::VisitConcreteElementB()
ConcreteElementB::Accept()
ConcreteVisitor2::VisitConcreteElementB()


Suresh Kumar Srivastava is founder of online learning site coursegalaxy.com and author of popular books C In Depth, Data Structures Through C In Depth. He has 18+ years experience in industry and worked on architecture and design of multiple products. This article Visitor Design Pattern In PHP is from his Design Patterns course.