200-710 Exam QuestionsBrowse all questions from this exam

200-710 Exam - Question 1


Consider the following two files. When you run test.php, what would the output look like?

Show Answer
Correct Answer: BC

When running test.php, the included file MyString.php defines a namespaced version of the strlen function, which does not interfere with the global strlen function. Therefore, when test.php calls strlen("Hello world!"), it uses the global strlen function, producing a length of 12. In MyString.php, strlen("Hello world!") uses the namespaced strlen function which returns double the length of the string, resulting in 24. Hence, the output is 12, followed by 24.

Discussion

1 comment
Sign in to comment
eastern_rohanOption: E
Oct 18, 2020

E. PHP Fatal error: Cannot redeclare strlen()

Raggi7
Nov 12, 2021

Different Scopes