nerdexam
National_Instruments

200-500 · Question #22

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) <?php class Car { var $model; function Car($model) { $this->model = $mo

Sign in or unlock 200-500 to reveal the answer and full explanation for question #22. The question stem and answer options stay visible for context.

Question

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) <?php class Car { var $model; function Car($model) { $this->model = $model; } function toString() { return "I drive a $this->model."; }} $c = new Car('Dodge'); echo $c->toString(); ?>

Options

  • AChange var to public or private
  • BChange function Car to function_construct
  • CChange "I drive a $this->model." to "I drive a {$this->model}."
  • DChange function toString()to static function toString()

Unlock 200-500 to see the answer

You've previewed enough free 200-500 questions. Unlock 200-500 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 200-500 Practice