Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend 200-710 Exam - Topic 4 Question 103 Discussion

Posted by Dierdre on May 07, 2026 at 06:42 AM

What is the output of the following code?

$a = 3;

switch ($a) {

case 1: echo 'one'; break;

case 2: echo 'two'; break;

default: echo 'four'; break;

case 3: echo 'three'; break;

}

Suggested Answer: C

Get Premium 200-710 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
29 comments · newest first
CA
Candra 7 days ago
Good catch on the break statements!
TR
Tran 12 days ago
I almost picked four, but three is correct.
VI
Viva 17 days ago
The switch statement is straightforward.
ER
Erick 22 days ago
I was confused at first, but it's clear now.
CH
Cherelle 28 days ago
Definitely three, default won't run.
LO
Lorean 1 month ago
I feel confident about this one.
OD
Odelia 1 month ago
Yeah, case 3 matches.
SH
Shenika 1 month ago
I think the output is three.
DE
Delmy 2 months ago
I hope they don't trick us with the default!
VA
Vanna 2 months ago
Same here, it's straightforward.
KE
Kenneth 2 months ago
I'm confident about this one!
DU
Dudley 2 months ago
Exactly, case 3 matches, so it prints 'three'.
LA
Launa 2 months ago
The default only runs if no case matches.
SU
Susy 2 months ago
But isn't 'four' the default?
MA
Mable 3 months ago
Yeah, because $a is 3.
AD
Adrianna 3 months ago
I think the output is 'three'.
LE
Lera 3 months ago
Nope, it's definitely 'three'.
CO
Colton 3 months ago
I thought it would be 'one' at first.
GR
Gregg 3 months ago
Wait, why is 'four' in the default?
TA
Tamekia 4 months ago
Totally agree, it's case 3!
GR
Gracie 4 months ago
The output is 'three'.
LA
Latia 4 months ago
Wait, I’m confused about the order of cases. Does the switch stop after the first match, or does it check all cases?
SA
Salena 4 months ago
I practiced a similar question where the switch statement had a default case too, and it seems like 'three' should be the output here.
DI
Dierdre 4 months ago
I'm not entirely sure, but I remember something about the default case being executed if no matches are found.
SH
Sharee 4 months ago
I think the switch statement will match the value of $a, which is 3, so it should output 'three'.
IN
Ines 5 months ago
Wait, does the default case get executed if there's a match? I feel like I might be mixing that up with something else.
AD
Adell 6 months ago
I practiced a similar question last week, and I think the order of cases matters. Since $a is 3, it should definitely go to case 3.
GE
Gearldine 6 months ago
I'm not entirely sure, but I remember something about the default case being executed if no matches are found.
ET
Ettie 6 months ago
I think the switch statement checks the value of $a, so it should match case 3 and output 'three', right?
0/2000 characters

Save Cancel