PHP连接变量 [英] PHP concatenate variable

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

问题描述

对你们来说可能是一个简单的问题.在Google上找不到它.

Might be an easy question for you guys. can't find it on google.

我正在尝试连接两个变量名称;

I am trying to concatenate two variables name;

$i=0;
 for ($i=0;$i<5;$i++){
   if($array[$i]>0){

   $test.$i=//do something
   }else{
  $test.$i=//do something
  }
}

//echo $test0 gives me nothing.
//echo $test1 gives me nothing.

我知道我不能使用$ test.$ i,但是不知道该怎么做.有帮助吗?谢谢!

I know I can't use $test.$i but don't know how to do this.Any helps? Thanks!

推荐答案

尝试${$test.$i} = value

http://php.net/manual/en/language. variables.variable.php

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

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