user1484136
user1484136

Reputation:

PHP merge array issues

I have an array as such

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
)

Upvotes: 1

Views: 125

Answers (1)

kirugan
kirugan

Reputation: 2624

Maybe something like this array_combine($ar[1], $ar[2]) ?

Upvotes: 5

Related Questions