Home >Backend Development >PHP Tutorial > 初学者有关问题 用变量值做变量名

初学者有关问题 用变量值做变量名

WBOY
WBOYOriginal
2016-06-13 13:50:11878browse

菜鸟问题 用变量值做变量名

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php $a=1;
$b=2;
$c="LL".$a.$b;
$$c="asdf";
echo $LL12;
?>


我希望生命一个变量
名字是
$LL12
后面的1 和2 是根据ab来的 有没有什么简单的方法可以不用中间变量$c

------解决方案--------------------
PHP code
$a=1;
$b=2;
eval("\$LL$a$b=\"asdf\";");
echo $LL12; <div class="clear">
                 
              
              
        
            </div>
Statement:
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