Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$x = "test";
$y = "this";
$z = "also"; 
$x .= $y .= $z ;
echo $x;
echo $y;
?>

A. testthisthisalso

B. testthis

C. testthisalsothisalso

D. error at line 4

Answer: Option C

Solution(By Examveda Team)

The x .= y is a shorthand for x = x.y and this is evaluated from right to left.

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

Join The Discussion

Related Questions on Operators and Expressions in php