PrepAway - Latest Free Exam Questions & Answers

Which of the listed changes would you make to the following PHP 4 code in order to make it most compliant with

Which of the listed changes would you make to the following PHP 4 code in order to make it most
compliant with PHP 5? (Choose 2)
<code>
<?php
classCar {
var$model;
functionCar($model) {
$this->model = $model;
} function toString() {
return”I drive a $this->model.”;
}}
$c = new Car(‘Dodge’);
echo$c->toString();
?>
</code>

PrepAway - Latest Free Exam Questions & Answers

A.
Changevar to public or private

B.
Change function Car tofunction_construct

C.
Change “I drive a $this->model.” to “I drive a {$this->model}.”

D.
Change functiontoString()to static function toString()


Leave a Reply

Your email address will not be published. Required fields are marked *