PHP中如何连接两个字符串

   2024-10-01 6440
核心提示:在PHP中连接两个字符串可以使用.操作符或者concat()函数。示例如下:使用.操作符:$str1 = Hello;$str2 = World;$result =

在PHP中连接两个字符串可以使用.操作符或者concat()函数。示例如下:

使用.操作符:

$str1 = "Hello";$str2 = "World";$result = $str1 . " " . $str2;echo $result; // 输出:Hello World

使用concat()函数:

$str1 = "Hello";$str2 = "World";$result = concat($str1, " ", $str2);echo $result; // 输出:Hello World

 
举报打赏
 
更多>同类物流大全
推荐图文
推荐物流大全
点击排行

网站首页  |  关于我们  |  联系方式网站留言    |  赣ICP备2021007278号