Home  >  Article  >  Backend Development  >  关于php数组,怎么显示元素本身字符

关于php数组,怎么显示元素本身字符

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

关于php数组,如何显示元素本身字符?
$data['a']=1;
$data['b']=2;
$data['c']=3;

我想显示:
a
b
c

不是要显示元素的值,而是要显示元素本身的字符

------解决方案--------------------
你说的是key?

$data=array('a'=>1,'b'=>2,'c'=>3);

foreach ($data as $key=>$value){
echo $key;
}
是不是key?还是啥意思.

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