连接两个变量 [英] Concatenate two variables

查看:43
本文介绍了连接两个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想要做的:

$errmsg_1 = 'Please make changes to your post';
$errmsg_2 = 'Please make changes to your post image';

$error = 1;

echo $errmsg_.$error; //'Please make changes to your post';

什么都行不通,而且有很多像这样的错误消息我必须回显.

Nothing will work, and there are many error messages like these ones that I have to echo.

有人可以帮忙吗?

推荐答案

在数组中存储错误信息:

Store error messages in array:

$errmsg[1] = 'Please make changes to your post';
$errmsg[2] = 'Please make changes to your post image';

// and so on

$error = 1;

echo $errmsg[$error];

这篇关于连接两个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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