"
<?PHP $str1= "PHP Tutorial"; $str2= "EndMemo"; $str3= $str1. " ". $str2;//EndMemo PHP Tutorial $str1.= " ". $str2;//EndMemo 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 ?>