PHP supports concatenation operator(. and .=), that is used to combine strings.
Here is an example for strings(here "welcome" and "to kolkata") combination using (.) operator:
<html> <body> <?php $a="welcome"; $b="to kolkata"; $c=$a.$b; echo $c; ?> </body> </html>
Output: welcometo kolkata
Below is an example for strings combination using (.=) operator:
<html> <body> <?php $a="welcome"; $b="to kolkata"; $b.=$a;//here $b.=$a means $b=$b.$a echo $b; ?> </body> </html>
Output: to kolkatawelcome
Here is a program to check where a string is a palindrome or not:
NB: A string is a palindrome if the string that reads the same backward as forwards, e.g., madam, using strcmp() function.
<html> <body> <?php $a="madam"; $b=strrev($a); if(strcmp($a,$b)==0) { echo "The string is a palindrome"; } else { echo "The string is not a palindrome"; } ?> </body> </html>
Output: The string is a palindrome