Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 581 Bytes

0465.md

File metadata and controls

30 lines (25 loc) · 581 Bytes

What is the output of the following code?

function print_conditional() {
   static $x;
   if ($x++ == 1) echo "many";
   echo "good";
   echo "things";
   return $x;
}

$x = 1;
print_conditional();
$x++;
print_conditional();
  • A) goodthingsmanygoodthings
  • B) manygoodthingsmanygoodthings
  • C) manygoodthings
  • D) goodthingsgoodthings
Answer

Answer: A