Computer Science, asked by abusalman8790, 1 year ago

What will be the output of the following PHP code?

<?php $color = "maroon"; $var = $color[2]; echo "$var"; ?>
A.a
B.Error
C.$var
D.r

Answers

Answered by Avanish010
1
hi there,

Option D is correct.

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

PHP stands for Personal Home Page - PHP HyperText Preprocessor.

IT is embedded into HTML and is used in various systems involving the web, like templates or content mangements.

Option D is the right answer here.

PHP treats everything inside " " (double quotes) as strings.

This is the same way as arrays which permit specific characters to be accessed through array offset notation.

Similar questions