Home > Backend Development > PHP Tutorial > 这个数组如何键值取值?

这个数组如何键值取值?

PHP中文网
Release: 2016-06-13 10:16:08
Original
875 people have browsed it

  这个数组怎么键值取值???

[国家/地区:] => Array
         (
             [0] => 中国大陆
         )
Copy after login

我要以键值取值??

------解决方案--------------------
不一定
 key($array)
------解决方案--------------------
抱歉。上面说反了
current() 函数可以返回数组的当前单元,默认的就是第一个
key()取当前单元的键值。
http://www.php.net/manual/zh/function.current.php
------解决方案--------------------
array_keys

遍历获取的键值数组

key配合current一定要先reset
------解决方案--------------------
遗憾的是,你只有一个键一个下标
['[国家/地区:'][0]
------解决方案--------------------
还要啥值,把值当成键用不就行了

以上就是这个数组如何键值取值?的内容,更多相关内容请关注PHP中文网(www.php.cn)!


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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template