[PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Brad LaFountain

When using array diff, if the last element and only the last element is
different it won't be returned as a difference.

?
$ar = array(b = 1, blah = 1);
$a1 = array(b = 2, blah = 2);
var_dump(array_diff($ar, $a1));
?
array(2) {
  [b]=
  int(1)
  [blah]=
  int(1)
}

?
$ar = array(b = 1, blah = 1);
$a1 = array(b = 1, blah = 2);
var_dump(array_diff($ar, $a1));
?
array(0) {
}


I can't look at this right now maybe I can later or tomarrow.


 - Brad


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Stig Venaas

On Tue, Aug 27, 2002 at 06:39:57AM -0700, Brad LaFountain wrote:
 ?
 $ar = array(b = 1, blah = 1);
 $a1 = array(b = 1, blah = 2);
 var_dump(array_diff($ar, $a1));
 ?
 array(0) {
 }

I guess this may not be clear from documentation. array_diff() works
with values. So it will return all values from first array that are
not in the others. Since the value 1 is present in $a1, all elements
of value 1 are removed from $ar in the returned array.

Stig

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Andrey Hristov

so, is there need of array_adiff()?

Best regards
Andrey Hristov


- Original Message - 
From: Stig Venaas [EMAIL PROTECTED]
To: Brad LaFountain [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 5:02 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different


 On Tue, Aug 27, 2002 at 06:39:57AM -0700, Brad LaFountain wrote:
  ?
  $ar = array(b = 1, blah = 1);
  $a1 = array(b = 1, blah = 2);
  var_dump(array_diff($ar, $a1));
  ?
  array(0) {
  }
 
 I guess this may not be clear from documentation. array_diff() works
 with values. So it will return all values from first array that are
 not in the others. Since the value 1 is present in $a1, all elements
 of value 1 are removed from $ar in the returned array.
 
 Stig
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Stig Venaas

On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
 so, is there need of array_adiff()?

Right, it should then work on ordered pairs, right? Only remove
(key, value) pair from 1st array if it exists in any of the others?
Same goes for array_intersect... I'm not sure if there is that much
of a need, but if there is one could either have new associative
ones, or flags to the existing ones. But first we should see if
there is a real need, then we need to see if someone will implent it.

Stig

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Brad LaFountain

Well I tried to use them like that, So I guess there is 
a little need. I wrote a simple php function to do the same thing.

I would volunteer but I have alot of stuff going on. Maybe
if I get borred sometime soon.

 - brad
--- Stig Venaas [EMAIL PROTECTED] wrote:
 On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
  so, is there need of array_adiff()?
 
 Right, it should then work on ordered pairs, right? Only remove
 (key, value) pair from 1st array if it exists in any of the others?
 Same goes for array_intersect... I'm not sure if there is that much
 of a need, but if there is one could either have new associative
 ones, or flags to the existing ones. But first we should see if
 there is a real need, then we need to see if someone will implent it.
 
 Stig
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Andrey Hristov

Hi,
I've done some hacking and have working (one example tested) array_diff()
modified to
be like array_adiff(). If there is interest I will provide a patch.

Best regards
Andrey Hristov


- Original Message -
From: Brad LaFountain [EMAIL PROTECTED]
To: Stig Venaas [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 5:29 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different


 Well I tried to use them like that, So I guess there is
 a little need. I wrote a simple php function to do the same thing.

 I would volunteer but I have alot of stuff going on. Maybe
 if I get borred sometime soon.

  - brad
 --- Stig Venaas [EMAIL PROTECTED] wrote:
  On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
   so, is there need of array_adiff()?
 
  Right, it should then work on ordered pairs, right? Only remove
  (key, value) pair from 1st array if it exists in any of the others?
  Same goes for array_intersect... I'm not sure if there is that much
  of a need, but if there is one could either have new associative
  ones, or flags to the existing ones. But first we should see if
  there is a real need, then we need to see if someone will implent it.
 
  Stig
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 __
 Do You Yahoo!?
 Yahoo! Finance - Get real-time stock quotes
 http://finance.yahoo.com

 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Marcus Börger

I think that would be interesting but could you perhaps
provide a more distinguishable name?

regards
marcus


At 20:35 27.08.2002, Andrey Hristov wrote:
Hi,
I've done some hacking and have working (one example tested) array_diff()
modified to
be like array_adiff(). If there is interest I will provide a patch.

Best regards
Andrey Hristov


- Original Message -
From: Brad LaFountain [EMAIL PROTECTED]
To: Stig Venaas [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 5:29 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different


  Well I tried to use them like that, So I guess there is
  a little need. I wrote a simple php function to do the same thing.
 
  I would volunteer but I have alot of stuff going on. Maybe
  if I get borred sometime soon.
 
   - brad
  --- Stig Venaas [EMAIL PROTECTED] wrote:
   On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
so, is there need of array_adiff()?
  
   Right, it should then work on ordered pairs, right? Only remove
   (key, value) pair from 1st array if it exists in any of the others?
   Same goes for array_intersect... I'm not sure if there is that much
   of a need, but if there is one could either have new associative
   ones, or flags to the existing ones. But first we should see if
   there is a real need, then we need to see if someone will implent it.
  
   Stig
  
   --
   PHP Development Mailing List http://www.php.net/
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
  __
  Do You Yahoo!?
  Yahoo! Finance - Get real-time stock quotes
  http://finance.yahoo.com
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Andrey Hristov

Today I am finished :(((
I will make the patch tommorow I will send it here.

array_diff_assoc()?
Propose names.

Regards,
Andrey Hristov


- Original Message -
From: Marcus Börger [EMAIL PROTECTED]
To: Andrey Hristov [EMAIL PROTECTED]
Cc: Brad LaFountain [EMAIL PROTECTED]; Stig Venaas [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 9:53 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different


 I think that would be interesting but could you perhaps
 provide a more distinguishable name?

 regards
 marcus


 At 20:35 27.08.2002, Andrey Hristov wrote:
 Hi,
 I've done some hacking and have working (one example tested) array_diff()
 modified to
 be like array_adiff(). If there is interest I will provide a patch.
 
 Best regards
 Andrey Hristov
 
 
 - Original Message -
 From: Brad LaFountain [EMAIL PROTECTED]
 To: Stig Venaas [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, August 27, 2002 5:29 PM
 Subject: Re: [PHP-DEV] array_diff not working with last element different
 
 
   Well I tried to use them like that, So I guess there is
   a little need. I wrote a simple php function to do the same thing.
  
   I would volunteer but I have alot of stuff going on. Maybe
   if I get borred sometime soon.
  
- brad
   --- Stig Venaas [EMAIL PROTECTED] wrote:
On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
 so, is there need of array_adiff()?
   
Right, it should then work on ordered pairs, right? Only remove
(key, value) pair from 1st array if it exists in any of the others?
Same goes for array_intersect... I'm not sure if there is that much
of a need, but if there is one could either have new associative
ones, or flags to the existing ones. But first we should see if
there is a real need, then we need to see if someone will implent
it.
   
Stig
   
--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
   __
   Do You Yahoo!?
   Yahoo! Finance - Get real-time stock quotes
   http://finance.yahoo.com
  
   --
   PHP Development Mailing List http://www.php.net/
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
 
 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] array_diff not working with last element different

2002-08-27 Thread Marcus Börger

Better, Thanks.

At 20:56 27.08.2002, Andrey Hristov wrote:
Today I am finished :(((
I will make the patch tommorow I will send it here.

array_diff_assoc()?
Propose names.

Regards,
Andrey Hristov


- Original Message -
From: Marcus Börger [EMAIL PROTECTED]
To: Andrey Hristov [EMAIL PROTECTED]
Cc: Brad LaFountain [EMAIL PROTECTED]; Stig Venaas [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, August 27, 2002 9:53 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different


  I think that would be interesting but could you perhaps
  provide a more distinguishable name?
 
  regards
  marcus
 
 
  At 20:35 27.08.2002, Andrey Hristov wrote:
  Hi,
  I've done some hacking and have working (one example tested) array_diff()
  modified to
  be like array_adiff(). If there is interest I will provide a patch.
  
  Best regards
  Andrey Hristov
  
  
  - Original Message -
  From: Brad LaFountain [EMAIL PROTECTED]
  To: Stig Venaas [EMAIL PROTECTED]; Andrey Hristov [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Tuesday, August 27, 2002 5:29 PM
  Subject: Re: [PHP-DEV] array_diff not working with last element different
  
  
Well I tried to use them like that, So I guess there is
a little need. I wrote a simple php function to do the same thing.
   
I would volunteer but I have alot of stuff going on. Maybe
if I get borred sometime soon.
   
 - brad
--- Stig Venaas [EMAIL PROTECTED] wrote:
 On Tue, Aug 27, 2002 at 05:04:41PM +0300, Andrey Hristov wrote:
  so, is there need of array_adiff()?

 Right, it should then work on ordered pairs, right? Only remove
 (key, value) pair from 1st array if it exists in any of the others?
 Same goes for array_intersect... I'm not sure if there is that much
 of a need, but if there is one could either have new associative
 ones, or flags to the existing ones. But first we should see if
 there is a real need, then we need to see if someone will implent
it.

 Stig

 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php

   
   
__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
   
--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php