Date: 10/21/00
- Next message: Jason Greene: "Re: [PHP-DEV] patch - adds new setting safe_mode_hide_env_vars"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] patch - adds new setting safe_mode_hide_env_vars"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 7194
Updated by: venaas
Reported By: s.busch <email protected>
Status: Closed
Bug Type: Feature/Change Request
Assigned To: venaas
Comments:
I wanted array_intersect() for "sets" where order is not important, but
I think you're right, it's good if the order is kept. I've now made both
array_intersect() and array_diff() keep the order.
Previous Comments:
---------------------------------------------------------------------------
[2000-10-13 13:59:15] s.busch <email protected>
The function array_intersect() does change the order of the elements
that are returned from array in first parameter. Since "order" is an essential feature of arrays it would be inconsistent to change it implicitely. Seems to be weak implementation of array_intersect().
(At least it should be documented, but i think it should be fixed)
I don't checked the other array-functions for this behavior, it could be that some show this inconsistency, too.
The resulting array seems to be in order of the contained values. In my example, the resulting array is alphabetically sorted:
---- code snippet ----
// result of array_intersect() is ex
$a = array(1=>'c',2=>'z',666=>'b',4=>'a');
$b = $a;
var_dump(array_intersect($a,$b));
---- result ----
array(4) {
[4]=>
string(1) "a"
[666]=>
string(1) "b"
[1]=>
string(1) "c"
[2]=>
string(1) "z"
}
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7194
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Jason Greene: "Re: [PHP-DEV] patch - adds new setting safe_mode_hide_env_vars"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] patch - adds new setting safe_mode_hide_env_vars"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

