Quiz 12/16: Answer the following question

  • Suggested by FredBouchery
  • Created on 2020-09-22
  • Difficulty: expert

What will be displayed in PHP 8? 🤔

PHP Quiz n°12

Select your answer: 🧐


✅ { answer }: correct!

❌ { answer }: Wrong answer!

PHP magic setters do not follow strict_types and you can set a property which does not exist. PHP 8 will not change this behavior. The right answer was "A".
▶  Click here to run this code on 3v4l.org

Poll

  • ✅ A: int(3) - 22.9%
    percent%
  • B: int(0) - 86%
    percent%
  • C: Fatal error: Uncaught TypeError: Foo::__set(): Argument #2 ($value) must be of type int, string given - 54.3%
    percent%
  • D: Fatal error: Uncaught Error: Cannot access undefined property Foo::$x - 0%
    percent%
▶  Click here to see the Twitter poll


Going further... 🤓

Want More? 🤔

New random question ⏩