Examveda
Examveda

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

A. redgreen

B. red green

C. 0

D. 1

Answer: Option C

Solution(By Examveda Team)

+ does not return 1 if the variables are equal.

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

Join The Discussion

Related Questions on Operators and Expressions in php