Home > php教程 > php手册 > body text

如何学习PHP array_flip()

WBOY
Release: 2016-06-13 09:29:42
Original
1211 people have browsed it

如何学习PHP array_flip()

定义和用法

array_flip() 函数返回一个反转后的数组,如果同一值出现了多次,则最后一个键名将作为它的值,所有其他的键名都将丢失。

如果原数组中的值的数据类型不是字符串或整数,函数将报错。

语法

array_flip(array)

 

参数

描述

 

array必需。规定输入的数组。

 

 

例子

"Dog",1=>"Cat",2=>"Horse");print_r(array_flip($a)); ?>

输出:

Array ( [Dog] => 0 [Cat] => 1 [Horse] => 2 )

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!