What will be the result of executing following code?
<?php
define('FOO', 10);
$array = array(10 => FOO, "FOO" => 20);
print $array[$array[FOO]] * $array["FOO"];
?>
Explanation
define('FOO', 10) defines const, that is means FOO without quotation = 10 in next two lines :

...
$array = array(10 => 10, "FOO" => 20);
print $array[$array[10]] * $array["FOO"];
...
print $array[10] * $array["FOO"];
...
print 10 * 20;
...
print 200;

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes