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!")
- 12, 12
- 12, 24
- 24, 12
- 24, 24
- PHP Fatal error: Cannot redeclare strlen()
Reveal Solution
Next Question