nerdexam
Zend

200-710 · Question #32

Consider the following two files. When you run test.php, what would the output look like? test.php: include "MyString.php"; print ", "; print strlen("Hello world!"); MyString.php: namespace…

The correct answer is C. 24,12. See the full explanation below for the reasoning.

Namespaces

Question

Consider the following two files. When you run test.php, what would the output look like? test.php: include "MyString.php"; print ", "; print strlen("Hello world!"); MyString.php: namespace MyFramework\String; function strlen($str) { return \strlen($str)*2; //return double the string length } print strlen("Hello world!");

Options

  • A12,12
  • B12,24
  • C24,12
  • D24,24
  • EPHP Fatal error: Cannot redeclare strlen()

How the community answered

(30 responses)
  • A
    17% (5)
  • B
    3% (1)
  • C
    70% (21)
  • D
    7% (2)
  • E
    3% (1)

Topics

#namespace function resolution#global fallback#function shadowing#namespace scope

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice