200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 13


What is the output of the following code?

Show Answer
Correct Answer: A,C

The reason is that the substr function in PHP when given a start position that is greater than the length of the string will return an empty string. In this case, since the string 'Good luck!' has a length of 10 and the starting position provided is also 10, there are no characters to return from that position onward, resulting in an empty string output, which is displayed as string(0) "" by var_dump.

Discussion

6 comments
Sign in to comment
ZhukovPeterOption: A
Jan 4, 2020

I think answer should be A. You can play this program on any PHP online playgrounds. Prorgram: $string = 'Good luck!'; $start = 10; var_dump(substr($string, $start)); output: string(0) ""

[Removed]Option: A
Jun 20, 2020

the Answer should be A.

Andres_Espinosa1Option: C
Apr 30, 2021

acabo de correr la linea de codigo y la respuesta es C sin duda

nicky91294Option: A
Jun 27, 2021

Answer is A

AndrewPetaPetaOption: A
Jul 29, 2021

The answer is A, without a doubt, please correct this.

thuanptOption: A
Oct 9, 2021

The answer is A,