如果输出等号前变量,该如何解决

WBOY
Release: 2016-06-13 13:44:40
Original
1008 people have browsed it

如果输出等号前变量
a.php $r1='xxx';
在b.php中引用a.php
在b.php中传递过来的参数id=1

id的值和a.php中的$r后面值一样
怎样在b.php中输出a.php中的$r[$id]的内容

------解决方案--------------------

PHP code
<?php $r1='hello world';

$id=1;
$r='r'.$id;
echo $$r;
?> <div class="clear">
                 
              
              
        
            </div>
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