如何在PHP中连接字符串 [英] How to concat string in PHP

查看:68
本文介绍了如何在PHP中连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这样做:

$string = "";
$string += "lol"; //maybe =+  > tried but both not working

但是它不起作用,有人建议吗? Google让我的生活变得不那么轻松(不能使用=或+这样的搜索字符)

But it isn't working, anyone suggestions? Google isn't making my life easy (cant search characters like = or +)

推荐答案

在PHP中,字符串连接是通过.运算符完成的:

In PHP, string concatenation is done with the . operator:

$string .= 'lol';

+用于添加.

这篇关于如何在PHP中连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆