473,498 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array's

I hace two arrays. 1 contain the list of files in a directory (array1) and
they other that contains file name stored in a DB (array2).

The idea is that I need to check if the files in array1 ar NOT present in
the DB array (2).

So i loop array1 and check against array2, not the problem. But when I find
a match It means its already in the DB so I need to remove it from the
array. not sure what function does this?
Nov 11 '08 #1
3 1285
Tree*Rat wrote:
So i loop array1 and check against array2, not the problem. But when I
find
a match It means its already in the DB so I need to remove it from the
array. not sure what function does this?
unset($array[n]);
See http://de.php.net/manual/en/function.unset.php
Sven Reuter
--
http://www.sReuter.net/
http://www.Auskennbert.de/
Nov 11 '08 #2
Tree*Rat escribió:
I hace two arrays. 1 contain the list of files in a directory (array1) and
they other that contains file name stored in a DB (array2).

The idea is that I need to check if the files in array1 ar NOT present in
the DB array (2).
http://es2.php.net/array_diff should do the trick.

So i loop array1 and check against array2, not the problem. But when I find
a match It means its already in the DB so I need to remove it from the
array. not sure what function does this?
Apply http://es2.php.net/unset on the array element you want to remove.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Nov 11 '08 #3
"Álvaro G. Vicario" <al****************@demogracia.comwrote in
news:gf**********@huron.algomas.org:
Tree*Rat escribió:
>I hace two arrays. 1 contain the list of files in a directory
(array1) and they other that contains file name stored in a DB
(array2).

The idea is that I need to check if the files in array1 ar NOT
present in the DB array (2).

http://es2.php.net/array_diff should do the trick.

>So i loop array1 and check against array2, not the problem. But when
I find a match It means its already in the DB so I need to remove it
from the array. not sure what function does this?

Apply http://es2.php.net/unset on the array element you want to
remove.
perfect.
Nov 12 '08 #4

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

Similar topics

2
2755
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
15
5153
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
3460
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
12
55523
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
10195
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
58
10042
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
104
16845
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
7
3165
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends...
17
7210
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6881
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
7375
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...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
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
3088
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.