BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend Exam 200-710 Topic 2 Question 76 Discussion

Actual exam question for Zend's 200-710 exam
Question #: 76
Topic #: 2
[All 200-710 Questions]

You want to access the 3rd character of a string, contained in the variable $test. Which of the following possibilites work? (Choose 2)

Show Suggested Answer Hide Answer
Suggested Answer: B, D

Contribute your Thoughts:

Cyril
1 months ago
Option B is the way to go. Accessing array elements using square brackets is the most straightforward and intuitive approach.
upvoted 0 times
Sheridan
3 days ago
User1: Great, thanks for confirming!
upvoted 0 times
...
Matthew
24 days ago
Yes, I agree. That's the correct way to access the 3rd character of a string.
upvoted 0 times
...
Marica
28 days ago
I think option B) echo $test[2]; is correct.
upvoted 0 times
...
...
Kimberlie
1 months ago
I'm not sure about option D) echo $test{2}. I think curly braces {} are used for variables, not string characters.
upvoted 0 times
...
Rhea
1 months ago
Haha, this is a classic PHP gotcha! I remember wasting an embarrassing amount of time on this exact question during my last interview.
upvoted 0 times
Hildred
1 months ago
D) echo $test{2};
upvoted 0 times
...
Brandon
1 months ago
B) echo $test[2];
upvoted 0 times
...
...
Sheridan
2 months ago
I agree with Kristeen. Using square brackets [] is the correct way to access characters in a string.
upvoted 0 times
...
Afton
2 months ago
D looks like the most logical choice to me. Who uses those weird parentheses anyway? Team curly braces all the way!
upvoted 0 times
Goldie
1 months ago
I always use curly braces for accessing characters in a string. E) echo $test{3}; is the way to go.
upvoted 0 times
...
Stephaine
1 months ago
Actually, D) echo $test{2}; is the correct syntax for accessing the 3rd character.
upvoted 0 times
...
Myong
2 months ago
I agree, B) echo $test[2]; is the correct way to access the 3rd character.
upvoted 0 times
...
Belen
2 months ago
I think B) echo $test[2]; would work too.
upvoted 0 times
...
...
Kristeen
2 months ago
I think the correct options are B) echo $test[2] and E) echo $test{3}
upvoted 0 times
...
Lauran
2 months ago
I was sure that A and C were the right answers. Guess I need to brush up on my PHP string manipulation skills.
upvoted 0 times
...
Ramonita
2 months ago
B and D are the correct options. Arrays in PHP are zero-indexed, so the 3rd character is at index 2.
upvoted 0 times
Tegan
1 months ago
D) echo $test{2};
upvoted 0 times
...
Tegan
2 months ago
B) echo $test[2];
upvoted 0 times
...
...

Save Cancel