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

This is a discussion on using array_intersect() without keeyping keys from the array1, i.e. re-number intersect array keys. within the PHP Language forums, part of the PHP Programming Forums category; hello all, I only use indexed arrays. When I use array_intersect function, of $a3 = array_intersect( $a1, $a2 ), I just need ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-29-2006
duzhidian@gmail.com
 
Posts: n/a
Default 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

Reply With Quote
  #2 (permalink)  
Old 07-29-2006
Andy Hassall
 
Posts: n/a
Default 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@gmail.com" <duzhidian@gmail.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.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:16 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0