Lets say we have variables: $page and $id. For example, $id=2. I wanna create new variable from existing variables $page and $id: $page2. how to do it? is it possible??
4条回答 默认 最新
- dpjo15650 2011-07-19 11:38关注
You can use curly brackets notation to create your variable name : http://codepad.org/L6B5vYdG
<?php $number = 2; ${'page' . $number} = 20 ; var_dump($page2); ?>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报