Programming Language PHP Basic MCQ Question #2359
Single Choice Not Set

QWhat will be the output of the following PHP code?
< ?php 
$color = "maroon";
$var = $color[2];
echo "$var" ;
?>

ID: #2359 PHP Basic MCQ 1,794 views
Question Info
#2359Q ID
Not SetDifficulty
PHP Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A a
  • B Error
  • C $var
  • D r
Correct Answer

Explanation

PHP treats strings in the same fashion as arrays, allowing for specific characters to be accessed via array offset notation.

Share This Question

Challenge a friend or share with your study group.