Multiple choice technology programming languages

$val = 26; $result = (++$val, $val+5); print $ result;

  1. 31

  2. 32

  3. 29

  4. 33

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The prefix increment ++$val changes $val from 26 to 27. The comma operator in scalar context evaluates the left expression, discards it, and returns the evaluation of the right expression, which is $val + 5, resulting in 27 + 5 = 32.