Contents

Programmer questions

Contents

What is the output for the following 3 code snippets?

// Snippet 1
$x = 3;
if (4 < $x) {
    print "The quick brown fox jumps over the lazy dog.";
} else {
    print "She sells seashells on the seashore.";
}

// Snippet 2
$x = 1;
$x = ++$x * 2;
print $x;

// Snippet 3
$x = 1;
$x = $x++ * 2;
print $x;