nerdexam
Zend

200-530 · Question #249

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) Zend 200-530 Exam <?php class Car { var $model; function Car($model)…

The correct answer is A. Change var to public or private B. Change function Car to function_construct. See the full explanation below for the reasoning.

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) Zend 200-530 Exam <?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()

How the community answered

(51 responses)
  • A
    82% (42)
  • C
    6% (3)
  • D
    12% (6)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice