?
What will be the output of the following PHP code?
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 & Solution
Correct Answer:
Option
D
PHP treats strings in the same fashion as arrays, allowing for specific characters to be accessed via array offset notation.
Join the Discussion
Login to post a comment or share your explanation.
Login