"> What will be the output of the following PHP code?<?php$var

Home » PHP » PHP Introduction » Question
  1. What will be the output of the following PHP code?
    <?php
    $var = "YELLOW";
    $var1 = $var[5];
    echo "$var1";
    ?>
    1. Y
    2. E
    3. L
    4. O
    5. W
Correct Option: D

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



Your comments will be displayed only after manual approval.