Question: PHP7: Adjust the speak method in the dog.php file to return the bark string but not print it. Also adjust the call to the method

PHP7:

Adjust the speak method in the dog.php file to return the bark string but not print it. Also adjust the call to the method in the lab.php file to display the output of the string. You can accept the string form the method and print the string in one line of code using syntax similar to the following: print $lab->speak();

dog.php:

class Dog

{

private $dog_weight = 0;

private $dog_breed = "no breed";

private $dog_color = "no color";

private $dog_name = "no name";

function get_properties()

{

return "$this->dog_weight,$this->dog_breed,$this->dog_color.";

}

}

?>

lab.php:

Require_once("e36dog.php");

$lab = new Dog;

$dog_properties = $lab->get_properties();

list($dog_weight, $dog_breed, $dog_color) = explode(',', $dog_properties);

print "Dog weight is $dog_weight. Dog breed is $dog_breed. Dog color is $dog_color.";

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!