πŸ“Š PHP
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
πŸ’¬ Discuss
βœ… Correct Answer: (C) Hello MCQ Buddy MCQ Buddy

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

Explanation by: Parvesh Kanani
The str1 .= str2 is a shorthand for str1 = str1.str2 and this is evaluated from right to left.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
184
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Parvesh Kanani
Publisher
πŸ“ˆ
89%
Success Rate