ExamVeda
Login
Home
This question belongs to PHP Basic PHP
Basic PHP
?

What will be the output of the following PHP code?
<?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.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.