473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

Jul 29 '06 #1
1 3807
On 28 Jul 2006 17:33:39 -0700, "du*******@gmail.com" <du*******@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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maggie Blue | last post by:
Hi! Total "newbie to programming" here. I'm using Jack's Formmail.php, code at: http://www.dtheatre.com/scripts/source_view.php?path=formmail_code/formmail.phps and I'm trying to figure out...
1
by: conor.robinson | last post by:
Using large arrays of data I found it is MUCH faster to cast arrays to matricies and then multiply the two matricies togther (scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix...
113
by: dan | last post by:
For writing a Windows desktop application, how much harder is it to use the Windows C API than C#/.NET, assuming the coding is done in an editor? What specific aspects were more difficult? I'm...
5
by: ZS | last post by:
Hi, Here is a piece of code where I have a class by name SomeClass array1 consists of objects of the type SomeClass array2 is intialized with contents of array1. Why does changes made to the...
6
by: paul.anderson | last post by:
I need to compare about 25k bytes of data. I'd like to be able to do a simple comparison of memory between 2 structures containing intrinsic data and find the position where the first difference...
22
by: J. Frank Parnell | last post by:
Hello, So, I was wondering how to do this: foreach($foo as $k=>$v AND $bar as $k2=>$v2){ echo '<TR><TD>$k</TD><TD>$v</TD><TD>$k2</TD><TD>$v2</TD></TR>; } Thanks,
23
by: Sacred Heart | last post by:
Hi, I'm new to Python and have come across a problem I don't know how to solve, enter com.lang.python :) I'm writing some small apps to learn the language, and I like it a lot so far. My...
3
by: poolboi | last post by:
hi guys, i dunno if this post should be in Perl or MySQL but i'm using Perl DBI to do manupilations now in MySQL i've got problem trying to input 2 arrays of data into 2 fields at the same...
4
by: cronusf | last post by:
I have code like this (pseudocode): MyClass::MyClass() { Array1 = new D3DXVECTOR3; Array2 = new USHORT; fx = gcnew Effect(); }
1
by: 493245744 | last post by:
#include<stdio.h> main() { long num1,num2; int mynum1,mynum2; int i,j,z,h; int array1,array2,array3; scanf("%d%d",&num1,&num2);
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.