"
<?PHP $str1= "PHP Tutorial"; $str2= "Perschon"; $str3= $str1. " ". $str2;//Perschon PHP Tutorial $str1.= " ". $str2;//Perschon PHP Tutorial ?>
"
<?PHP $arr = array("php","js","python"); $str = ""; for ($ii=0; $ii<count($arr); $ii++) { $str .= $arr[$ii] . " "; } echo "$str"; //result is "php js python " ?>
Function
<?PHP $arr=array("php","js","python"); $str=implode(" ", $arr); echo "$str"; //php js python $arr=array("php","js","python"); $str=implode(" + ", $arr); echo "$str"; //php + js + python ?>
Use
<?PHP $name = "Johnson"; $age = 24; $str = sprintf("%s is %s year old",$name, $age); echo "$str"; //Johnson is 24 year old ?>