Zend
200-710 · Question #3
What is the output of the following code? $string = 'Good luck!'; $start = 10; var_dump(substr($string, $start, $start));
The correct answer is C. string(1) "!". See the full explanation below for the reasoning.
Strings & Patterns
Question
What is the output of the following code?
$string = 'Good luck!';
$start = 10;
var_dump(substr($string, $start, $start));
Options
- Astring(0) ""
- Bbool(false)
- Cstring(1) "!"
- Dstring(2) "k!"
How the community answered
(59 responses)- A15% (9)
- B5% (3)
- C69% (41)
- D10% (6)
Topics
#substr#string indexing#edge cases#string functions
Community Discussion
No community discussion yet for this question.