classJumpimplementsAnimalOperation{publicfunctionvisitMonkey(Monkey $monkey){echo'Jumped 20 feet high! on to the tree!';}publicfunctionvisitLion(Lion $lion){echo'Jumped 7 feet! Back on the ground!';}publicfunctionvisitDolphin(Dolphin $dolphin){echo'Walked on water a little and disappeared';}}$jump=newJump();$monkey->accept($speak);// Ooh oo aa aa!$monkey->accept($jump);// Jumped 20 feet high! on to the tree!$lion->accept($speak);// Roaaar!$lion->accept($jump);// Jumped 7 feet! Back on the ground!$dolphin->accept($speak);// Tuut tutt tuutt!$dolphin->accept($jump);// Walked on water a little and disappeared