Which code snippet uses the correct syntax for creating an instance of the Pet class?

✅  The correct answer is:

all of these answers

Question:

Which code snippet uses the correct syntax for creating an instance of the Pet class?

Solution:

  • $dog = new Pet;
  • all of these answers
  • $horse = (new Pet);
  • $cat = new Pet();