1<?php
2$number = 8;
3$txt = "the number is".$number.", ok?"; //Use a dot to combine
4echo $txt;
5?>
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$mystring1 .= $mystring2;
5echo($mystring1);
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