The concat() method is used to join two or more strings.
This method does not change the existing strings, but returns a new string containing the text of the joined strings.
string.concat(string1, string2, ..., stringX)
string1 - First string to be joined.
string2 - Second string to be joined. Up to N number of strings can be specified this way.Explaination:
when you need Displaying more than one strings or combining the two strings where there may be variables or other things between them,
it would be annoying to write a new statement to echo all the parts. php has a nice way of doing this for you, string concatenating
let me show you an example:
The . operator is the string concatenation operator and is very useful for situations like this.
( i left spaces after and before '.' operators to make them more visible. this is not needed in fact. )
Example For HTML String
<div class="test" name="<?php echo This." ".is." ".$row['name']." ".Blog; ?>"><div>
Example For PHP String
echo '<div class="test" name=" '.This.' '.is.' '.$row['name'].' '.ucwords($row['blog']).'"></div>';