The PHP Concatenation Operator.
There is only one string operator in PHP.
The concatenation operator (.) is used to join two string values together.
The example below shows how to concatenate two string variables together:
Example
<?php
$txt1="Hello friends!";
$txt2="what about you!";
echo $txt1 . " " . $txt2;
?>
$txt1="Hello friends!";
$txt2="what about you!";
echo $txt1 . " " . $txt2;
?>
OUTPUT: Hello friends! what about you!
Sometimes this operator perform a most importent role in our PHP script when we have a number of variables then with the help of this variable we can describe them in small portion
The PHP strlen() function
Sometimes it is useful to know the length of a string value.The strlen() function returns the length of a string, in characters.
The example below returns the length of the string "Hello world!":
Example
<?php
echo strlen("Hello friends!");
?>
echo strlen("Hello friends!");
?>
OUTPUT: 14
This script becomes very useful when you needs to count the total number of words in your PHP page. for eg: name , Password length excitation.
This script becomes very useful when you needs to count the total number of words in your PHP page. for eg: name , Password length excitation.