Cyber Monday 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
2 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
26 days ago
User1: Great, thanks for confirming!
upvoted 0 times
...
Matthew
2 months ago
Yes, I agree. That's the correct way to access the 3rd character of a string.
upvoted 0 times
...
Marica
2 months ago
I think option B) echo $test[2]; is correct.
upvoted 0 times
...
...
Kimberlie
2 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
2 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
2 months ago
D) echo $test{2};
upvoted 0 times
...
Brandon
2 months ago
B) echo $test[2];
upvoted 0 times
...
...
Sheridan
3 months ago
I agree with Kristeen. Using square brackets [] is the correct way to access characters in a string.
upvoted 0 times
...
Afton
3 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
2 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
2 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
3 months ago
I think the correct options are B) echo $test[2] and E) echo $test{3}
upvoted 0 times
...
Lauran
3 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
3 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
2 months ago
D) echo $test{2};
upvoted 0 times
...
Tegan
3 months ago
B) echo $test[2];
upvoted 0 times
...
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77