What is displayed when the following script is executed?
define(myvalue, "10");
$myarray[10] = "Dog";
$myarray[] = "Human";
$myarray['myvalue'] = "Cat";
$myarray["Dog"] = "Cat";
print "The value is: ";
print $myarray[myvalue]."\\n";
-
The value is: Dog
-
The value is: Cat
-
The value is: Human
-
The value is: 10
A
Correct answer
Explanation
The constant 'myvalue' is defined as '10'. In '$myarray[myvalue]', PHP uses the constant's value, accessing '$myarray[10]'. Since '$myarray[10]' was assigned the string 'Dog', the output is 'The value is: Dog'. The later assignment to the string key 'myvalue' does not affect this.