PHP合并数组问题 [英] PHP merge array issues

查看:69
本文介绍了PHP合并数组问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的数组

Array
(
[1] => Array
    (
        [0] => PrettyName1
        [1] => PrettyName2
        [2] => PrettyName3
    )

[2] => Array
    (
        [0] => UglyURL1
        [1] => UglyURL2
        [2] => UglyURL3
    )

)

我希望能够将它们放入代码点火器模板的数组中,当我推入并合并数组时,我最终把整个事情搞砸了.有人可以向我展示合并这些数组的正确方法吗?我需要

I want to be able to put these into an array for a code-igniter template, well when I push and merge arrays I end up messing the whole thing up. Can someone show me the proper way to merge these arrays? I need something like

Array
(
    PrettyName1 => UglyURL1
    PrettyName2 => UglyURL2
    PrettyName3 => UglyURL3
)

推荐答案

也许是这样的array_combine($ar[1], $ar[2])吗?

这篇关于PHP合并数组问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆