nerdexam
Zend

200-710 · Question #225

What is the output of the following code? `` $a=1; $b=2; $c=3; Print (++$a) + (++$b) + (++$c) + ($a++) + (++$b) + ($c++); ``

The correct answer is A. 18. See the full explanation below for the reasoning.

PHP Basics

Question

What is the output of the following code?
$a=1;
$b=2;
$c=3;
Print (++$a) + (++$b) + (++$c) + ($a++) + (++$b) + ($c++);

Options

  • A18
  • B
  • C
  • D

How the community answered

(45 responses)
  • A
    71% (32)
  • B
    9% (4)
  • C
    4% (2)
  • D
    16% (7)

Topics

#pre-increment#post-increment#operator precedence#arithmetic

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice