nerdexam
Zend

200-550 · Question #18

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.

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

(36 responses)
  • A
    8% (3)
  • B
    3% (1)
  • C
    75% (27)
  • D
    3% (1)
  • E
    11% (4)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice