Home  >  Article  >  Backend Development  >  How to change array key value in PHP

How to change array key value in PHP

不言
不言Original
2018-05-03 14:47:402776browse

This article mainly introduces the method of changing the array key value in PHP. It has a certain reference value. Now I share it with you. Friends in need can refer to it

$keys = range(0, count($infos)-1);//重新生成指定范围的数组
$arr = array_combine($keys, array_values($infos));//将键和值重新组合,形成新数组


The above is the detailed content of How to change array key value in PHP. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:PHP code optimizationNext article:PHP code optimization