Home  >  Article  >  Backend Development  >  PHP的弱智有关问题

PHP的弱智有关问题

WBOY
WBOYOriginal
2016-06-13 13:33:12809browse

PHP的弱智问题
我有这么一个数组Array ( [A] => 22 [B] => 12 [C] => 6 ) 

我怎么样才能得到相应属性的值,然后类似于输出A:22,B:12,C:16的格式呢??

有一个问题是这个A\B\C不固定,可能是E\F\G(动态的)






------解决方案--------------------
我想你要的是这个
$ar = array ( 'A' => 22, 'B' => 12, 'C' => 6 );
echo json_encode($ar);


{"A":22,"B":12,"C":6}

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

我看楼主也是要这样。。json格式

探讨

我想你要的是这个
$ar = array ( 'A' => 22, 'B' => 12, 'C' => 6 );
echo json_encode($ar);


{"A":22,"B":12,"C":6}
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