1<?php
2
3// First String
4$a = 'Hello';
5
6// Second String
7$b = 'World!';
8
9// Concatenation Of String
10$c = $a.$b;
11
12// print Concatenate String
13echo " $c \n";
14?>
15
1phpCopy<?php
2$mystring1 = "This is the first string. ";
3$mystring2 = "This is the second string. ";
4$mystring3 = "This is the third string. ";
5$mystring4 = "This is the fourth string. ";
6$mystring5 = "This is the fifth string.";
7
8$mystring1 .= $mystring2 .= $mystring3 .= $mystring4 .= $mystring5;
9echo($mystring1);
10?>
11
1phpCopy<?php
2$mystring1 = "This is the first string. ";
3$mystring2 = "This is the second string";
4$finalString = sprintf("%s %s", $mystring1, $mystring2);
5echo($finalString);
6?>
7
1phpCopy<?php
2$mystring1 = "This is the first string. ";
3$mystring2 = "This is the second string. ";
4$mystring3 = "This is the third string. ";
5$mystring4 = "This is the fourth string. ";
6$mystring5 = "This is the fifth string.";
7
8$finalString = $mystring1 . $mystring2 . $mystring3 . $mystring4 . $mystring5;
9echo($finalString);
10?>
11
1phpCopy<?php
2$mystring1 = "This is the first string. ";
3$mystring2 = "This is the second string.";
4$finalString = $mystring1 . $mystring2;
5echo($finalString);
6?>
7