Exam 200-710 All QuestionsBrowse all questions from this exam
Question 1

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

    Correct Answer: B

    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
eastern_rohanOption: E

E. PHP Fatal error: Cannot redeclare strlen()

Raggi7

Different Scopes