Clayton_305
0
Q:

concatenate string php

$a = "hello";
$b = "world";
$c = $a . " " . $b;

echo $c; // hello world
4

var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
// does not change the existing strings, but
// returns a new string containing the text
// of the joined strings.
4
<?php
$a = "Hello ";
$b = $a . "World!"; // now $b contains "Hello World!"

$a = "Hello ";
$a .= "World!";     // now $a contains "Hello World!"
?>
3
<?php 

// First String 
$a = 'Hello'; 

// Second String 
$b = 'World!'; 

// Concatenation Of String 
$c = $a.$b; 

// print Concatenate String 
echo " $c \n"; 
?> 
1

New to Communities?

Join the community