A

Admin • 833K Points
Coach

Q. What will be the output of the following PHP code ?

Code:
<?php
$str1 = "Hello ";
$str2 = "MCQ";
$str3 = "Buddy";
$str1 .= $str2 .= $str3 ;
echo $str1;
echo $str2;
?>
  • (A) Hello MCQ Buddy
  • (B) MCQ Buddy
  • (C) Hello MCQ Buddy MCQ Buddy
  • (D) MCQ Buddy MCQ Buddy
  • Correct Answer - Option(C)
  • Views: 17
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin

The str1 .= str2 is a shorthand for str1 = str1.str2 and this is evaluated from right to left.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.