Quiz 27/27: Answer the following question

  • Suggested by FredBouchery
  • Created on 2020-11-19
  • Difficulty: expert

PHP 8 quiz: What will be displayed? 🤔

PHP Quiz n°27

Select your answer: 🧐


✅ { answer }: correct!

❌ { answer }: Wrong answer!

It is possible that two implemented interfaces use the same name, but the signatures must be identical. Since PHP 8, contravariance allows to widen the parameter type, so this code is allowed.
▶  Click here to run this code on 3v4l.org

Poll

  • A: TypeError int expected - 10%
    percent%
  • B: TypeError string expected - 8%
    percent%
  • C: Fatal declaration compat. - 51%
    percent%
  • ✅ D: boolean - 31%
    percent%
▶  Click here to see the Twitter poll


Going further... 🤓

Want More? 🤔

👈️ Get back to first question