Home > Backend Development > PHP Tutorial > 请教一个问题,如何将两个变量“粘”在一起?

请教一个问题,如何将两个变量“粘”在一起?

WBOY
Release: 2016-06-23 14:01:39
Original
1008 people have browsed it

是指变量名“粘”在一起,怎么描述好呢……


例如有一些变量分别叫 $a1 $a2 $a3

我想要

for (i=0;i
怎么办呢 

不要用数组……


回复讨论(解决方案)

$a1=1 ;$a2=2 ;$a3=3;for ($i=0;$i<3;$i++) echo ${'a'.($i+1)}.PHP_EOL;
Copy after login
Copy after login

1
2
3

$a1=1 ;$a2=2 ;$a3=3;for ($i=0;$i<3;$i++) echo ${'a'.($i+1)}.PHP_EOL;
Copy after login
Copy after login

1
2
3

又遇到你了。。大神。。 非常感谢~~

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template