merge values of the relative indexes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    merge values of the relative indexes

    hi,
    i need to merge the values of arrays in the follwoing manner ,
    Code:
    $a1=array('a','b','c');
    $a2=array('1','2','3');
    and after merging the 2 arrays the resultant array should look like this
    Code:
    array('a|1','b|2','c|3');
    i have looked into array_merge() and array_combine() but they wont help in this case, does anybody knows a function that would work in this regard i donot want to iterate to each index with a loop as the arrays could be large and it would consume more time.
    regards,
    Omer Aslam.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    There's no way around iterating through the array. If a function existed that did what you wanted to do, it would necessarily have to iterate through the array.

    Comment

    Working...