Well done!

You have completed Working with Objects!

Quiz Question 1 of 5

The code block below includes a third-party library that makes available a simple object that adds two numbers together. (There are easier ways to add numbers together in PHP; this is just an example.) The doAdder() method adds the value of the number1 property to the value of the number2 property; it then returns the sum as its return value. What would the following code display to the screen?

include "inc/class.adder.php";

$my_summer = new Adder();

$my_summer->number1 = 2;

$my_summer->number2 = 3;

if ($my_summer->doAdder() < 10) {

    echo "Your sum has only one digit.";

} else {

    echo "Your sum has two or more digits.";    

}

Choose the correct answer below:

Skip Quiz Review Video