nerdexam
Zend

200-710 · Question #92

What is the output of the following code? function ratio ($x1 = 10, $x2) { if (isset ($x2)) { return $x2 / $x1; } } echo ratio (0);

The correct answer is D. A warning, because $x2 is not set. See the full explanation below for the reasoning.

Functions

Question

What is the output of the following code? function ratio ($x1 = 10, $x2) { if (isset ($x2)) { return $x2 / $x1; } } echo ratio (0);

Options

  • A0
  • BAn integer overflow error
  • CA warning, because $x1 is not set
  • DA warning, because $x2 is not set
  • EA floating-point overflow error
  • FNothing

How the community answered

(63 responses)
  • A
    5% (3)
  • C
    8% (5)
  • D
    73% (46)
  • E
    13% (8)
  • F
    2% (1)

Topics

#default parameters#parameter order#required parameters#warnings

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice