PHP多个变量怎么组成一个变量

WBOY
Release: 2016-06-13 12:17:47
Original
1717 people have browsed it

PHP多个变量如何组成一个变量?
$xx['d1'][2]='你好!';

$a='xx';
$b='1';


我试过以下的写法,不对。
echo ${$a.'["d'.$b.'"][1]'};


求教如何组成一个变量作为输出?
------解决思路----------------------

<br />$xx['d1'][2]='你好!';<br /><br />$a='xx';<br />$b='1';<br /><br />echo ${$a}['d'.$b][2];<br />
Copy after login


是这样个意思么?
------解决思路----------------------
<br />    $array = array(1=>'a', 2=>'b');<br />    $name = 'array';<br />    $key = 1;<br />    echo ${$name}[$key];<br />
Copy after login

------解决思路----------------------
echo ${$a}['d'.$b][1];
------解决思路----------------------
<br />$xx['d1'][2]='abc';<br /><br />$a='xx';<br />$b='1';<br /><br />echo ${$a}['d'.$b][2];<br />
Copy after login

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!