Question
What will be the output of the following PHP code?
< ?php
$color = "maroon";
$var = $color[2];
echo "$var" ;
?>
< ?php
$color = "maroon";
$var = $color[2];
echo "$var" ;
?>
Answer: Option D
Was this answer helpful ?
PHP treats strings in the same fashion as arrays, allowing for specific characters to be accessed via array offset notation.
Was this answer helpful ?
Submit Solution