Which PHP script uses a constructor to display the string “Winter is almost over!”?

✅  The correct answer is:

[ ]
1 class MyClass { //Maybe
2 public function \_construct()
3 {
4 echo ‘Winter is almost over!’.”\n”;
5 }
6 }
7 \$userclass = new MyClass;

Question:

Which PHP script uses a constructor to display the string “Winter is almost over!”?

Solution:

  • [ ]
    1 class MyClass { //Maybe
    2 public function \_construct()
    3 {
    4 echo ‘Winter is almost over!’.”\n”;
    5 }
    6 }
    7 \$userclass = new MyClass;
  • [ ]
    1 class MyClass {
    2 public function _construct()
    3 {
    4 echo ‘Winter is almost over!..”\n”;
    5 }
    6 }
    7 $userclass = new MyClass;
  • [ ]
    1 class MyClass {
    2 public function \_construct()
    3 {
    4 echo ‘Winter is almost over!..”\n”;
    5 }
    6 }
    7 \$userclass = new MyClass;
  • [ ]
    1 class MyClass {
    2 public function _construct()
    3 {
    4 echo ‘Winter is almost over!’.”n”;
    5 }
    6 }
    7 $userclass = MyClass;