using array_intersect() without keeyping keys from the array1, i.e. re-number intersect array keys.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • duzhidian@gmail.com

    using array_intersect() without keeyping keys from the array1, i.e. re-number intersect array keys.

    hello all,

    I only use indexed arrays.

    When I use array_intersect function, of $a3 = array_intersect ( $a1,
    $a2 ), I just need the vales of intersect array and let keys to be
    re-numberred from 0.;

    I found the intersect array $a3 have the correct values but keep the
    keys of $a1. When I use
    for loop from $index=0 to sizeof ($a3)-1, by $a3[$index], php reports
    "undefined offset " problem.

    How can I re-number the keys of $a3 from 0 to sizeof($a3)-1;

    Thans.

    Zhidian Du

  • Andy Hassall

    #2
    Re: using array_intersect () without keeyping keys from the array1, i.e. re-number intersect array keys.

    On 28 Jul 2006 17:33:39 -0700, "duzhidian@gmai l.com" <duzhidian@gmai l.com>
    wrote:
    >I only use indexed arrays.
    >
    >When I use array_intersect function, of $a3 = array_intersect ( $a1,
    >$a2 ), I just need the vales of intersect array and let keys to be
    >re-numberred from 0.;
    >
    >I found the intersect array $a3 have the correct values but keep the
    >keys of $a1. When I use
    >for loop from $index=0 to sizeof ($a3)-1, by $a3[$index], php reports
    >"undefined offset " problem.
    >
    >How can I re-number the keys of $a3 from 0 to sizeof($a3)-1;
    array_values

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    Working...