Home > php教程 > php手册 > ,把某个变量值当变量名如何写

,把某个变量值当变量名如何写

WBOY
Release: 2016-06-06 19:41:30
Original
1167 people have browsed it

在线等,把某个变量值当变量名怎么写? $data是JSON,已经解码。 现在问题是$week的值为1,如何调用$data[0]-d13。其中d+$week的值+'3' 怎么写?? 我用$$好像不行呀。 求解!! ------解决思路---------------------- $data=【本文来自鸿网互联 (http://www.

在线等,把某个变量值当变量名怎么写?
$data是JSON,已经解码。
现在问题是$week的值为1,如何调用$data[0]->d13。其中d + $week的值 + '3'
怎么写??
我用$$好像不行呀。
求解!!

------解决思路----------------------
$data = 【本文来自鸿网互联 (http://www.68idc.cn)】json_decode('[{"d13":123}]');<br />
$week = 1;<br />
echo $data[0]->{'d'.$week.'3'};<br />
Copy after login
<br />
123<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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template