Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$color = red;
echo "$color";
?>

A. red

B. $color

C. red

D. Error

Answer: Option B

Solution(By Examveda Team)

To print red remove the .

This Question Belongs to PHP >> Operators And Expressions In Php

Join The Discussion

Comments ( 2 )

  1. عبووود الأسطا
    عبووود الأسطا :
    2 years ago

    this code will occur an error
    because the word 'red' is not in single or double quotation;

  2. Ayussh Srivastav
    Ayussh Srivastav :
    3 years ago


    output will be:
    red
    #(where's the '.' according to solution in examveda)

Related Questions on Operators and Expressions in php