【数组】array_push 函数给数组增添索引

WBOY
Release: 2016-06-13 12:59:30
Original
1841 people have browsed it

【数组】array_push 函数给数组添加索引

array_push($mo_ban, '标题');
Copy after login

结果是:Array ( [yong_hu] => admin [0] => 标题 )

但我想让结果是:Array ( [yong_hu] => admin [biao_ti] => 标题 )

怎给数组添加元素的时候把索引添加进去呀?


------解决方案--------------------
$mo_ban['biao_ti'] = '标题';

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 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!