Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$color1 = red;
$color2 = green;
echo "$color1"."$color2";
?>

A. red green

B. red

C. green

D. error

Answer: Option D

Solution(By Examveda Team)

It has to be $color1 = “red”; and $color2 = “green”; therefore the error.

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

Join The Discussion

Related Questions on Operators and Expressions in php