Commit Graph

56 Commits

Author SHA1 Message Date
Sebastian Bergmann
3717df72ae Bump year. 2007-01-01 09:29:37 +00:00
Marcus Boerger
da5c076100 - Add array_fill_keys() (Matt W, php_lists at realplain com) 2006-07-15 10:10:47 +00:00
Andrei Zmievski
a871adf6bb MFB 2006-06-03 18:58:40 +00:00
Derick Rethans
ad6a972de3 - Implemented basic collation support. For some reason "new Collator" gives segfaults when the object's collation resource is used.
- The following example shows what is implemented:

<?php
$orig = $strings = array(
    'côte',
    'cote',
    'côté',
    'coté',
    'fluße',
    'flüße',
);

echo "German phonebook:\n";
$c = collator_create( "de@collation=phonebook" );
foreach($c->sort($strings) as $string) {
    echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
    ? "With" : "Without", " french accent sorting order\n";

echo "\nFrench with options:\n";
$c = collator_create( "fr" );
$c->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
$c->setAttribute(Collator::CASE_LEVEL, Collator::ON);
$c->setStrength(Collator::SECONDARY);
foreach($c->sort($strings) as $string) {
    echo $string, "\n";
}
echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON
    ? "With" : "Without", " french accent sorting order\n";
?>
2006-03-26 11:06:24 +00:00
Andrei Zmievski
f0a9b2d51b MFB. 2006-02-07 17:54:52 +00:00
foobar
251c5173fd bump year and license version 2006-01-01 13:10:10 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
Andrey Hristov
be3a9ccdf3 add function array_product() 2005-05-11 11:43:11 +00:00
Marcus Boerger
db47e478c5 - Use new way for global variables
- Cache class lookup
2004-11-01 12:09:46 +00:00
Andrey Hristov
5e5d2640fb add array_:
intersect_key()
intersect_ukey()
diff_key()
diff_ukey()
The first two by a patch of Cristiano Duarte. The second two were
implemented in almost the same way except one small difference.
2004-07-21 21:17:56 +00:00
foobar
ccfc46b0aa - Happy new year and PHP 5 for rest of the files too..
# Should the LICENSE and Zend/LICENSE dates be updated too?
2004-01-08 17:33:29 +00:00
Andrey Hristov
638b940307 New array functions for doing intersection of arrays that are complementary
to array_*diff* family of functions. Namely array_uintersect(), array_uintersect_assoc(),
array_intersect_uassoc() and array_uintersect_uassoc(). Test case is also included.
#docs and news entry later.
2003-10-09 08:10:39 +00:00
Andrey Hristov
3579f212df 4 new functions :
array_udiff()
array_udiff_assoc()
array_diff_uassoc()
array_udiff_uassoc()
They work like array_diff() or array_diff_assoc() but callback function(s)
can be used to perform the comparisons. For example array_udiff_uassoc()
expects 2 callbacks are last 2 parameters one is used to compare the values
of the entries in the arrays the second to compare the keys.
Class methods are also valid callbacks. Even when the data that should be
used in the comparison is private or protected then a static method of a
class should be used (this behaviour can be seen in the regression test -
007.phpt).
2003-09-23 17:37:29 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Ilia Alshanetsky
f12a6b7663 Added array_walk_recursive() function that can apply array_walk recursively
to an array.
2003-02-05 17:56:08 +00:00
Andrey Hristov
1cdc956637 added array_combine().
Creates an array by using the elements of the first parameter as keys and
the elements of the second as correspoding keys. Error is thrown in case
the arrays has different number of elements. Number of elements 0 is not
valid for both parameters.
2003-01-13 18:12:23 +00:00
Sebastian Bergmann
b506f5c8f8 Bump year. 2002-12-31 16:08:15 +00:00
Andrey Hristov
a920f00479 New function added - array_intersect_assoc() similar to array_intersect()
but the keys are also used in the comparison. So the result is a subset of
the result of array_intersect().
Test will be committed too.
2002-09-21 14:50:04 +00:00
Andrey Hristov
afdfe38ef3 New function added : array_diff_assoc() . Like array_diff() but does
additional checks on key values. Test script will be added too.
#My first patch . it feels strange :)
2002-09-11 18:13:48 +00:00
Edin Kadribasic
333b01b041 Fixed ZTS build. 2002-09-10 22:36:43 +00:00
Andrei Zmievski
dd7cf22443 @- Fixed array_merge_recursive() to avoid problems with merging cyclical
@  arrays (bug #16064). (Andrei)
2002-09-10 18:34:16 +00:00
Andrei Zmievski
1668570e4d Changing email address. 2002-05-13 17:28:38 +00:00
Sebastian Bergmann
38933514e1 Update headers. 2001-12-11 15:32:16 +00:00
Derick Rethans
78e4644fa1 - Renaming key_exists to array_key_exists
@- Renamed key_exists tp array_key_exists. (Derick)
#- Not sure if this belongs in NEWS, but it was already in a released
#  version. And yes, I know I'm breaking BC here, but as it was not documented
#  yet, that doesn't matter.
2001-11-11 18:28:43 +00:00
Andrei Zmievski
2890b57e46 @- Added array_chunk() function that splits an array into chunks of specified
@  size. (Andrei)
2001-10-27 05:11:15 +00:00
Rasmus Lerdorf
72fc6bc4b1 As suggested on php-dev, array_fill() is probably a better name for this
function.
2001-10-23 18:46:35 +00:00
Rasmus Lerdorf
798ec79319 Motivated by bug #13607 I wrote up a simple array_init() function that
lets you quickly create an array and initialize each element to a certain
value.
@ Add array_init() function (Rasmus)
2001-10-21 07:42:35 +00:00
Edin Kadribasic
e78b61542d Added array_change_key_case() function that returns array with
with all string keys lowercased or uppercased
@- Added array_change_key_case() function that returns array with
@  with all string keys lowercased or uppercased (EdinK)
2001-10-05 18:38:53 +00:00
Sterling Hughes
bcb426a207 Merge in qsort changes 2001-09-17 21:02:53 +00:00
Zeev Suraski
7b1c400631 More TSRMLS_FETCH annihilation (Zend compatibility patch) 2001-07-30 04:58:07 +00:00
Zeev Suraski
d87cc976e1 Redesigned thread safety mechanism - nua nua 2001-07-28 11:36:37 +00:00
David Croft
34f03f2c5c @ - Added key_exists() to check if a given key or index exists in an
@ array or object (David Croft)
Added key_exists() to check if a given key or index exists in an array or object
2001-04-30 04:06:09 +00:00
Andrei Zmievski
d9aa966a44 @- Added array_map() function that applies a callback to the elements
@  of given arrays and returns the result. It can also be used with a
@  null callback to transpose arrays. (Andrei)
2001-03-19 21:20:02 +00:00
Andrei Zmievski
770c66125d @- Added array_filter(), which allows filtering of array elements via
@  the specified callback. (Andrei)
2001-03-16 20:46:33 +00:00
Andrei Zmievski
d73ef12429 @- Added array_reduce(), which allows iterative reduction of an array
@  to a single value via a callback function. (Andrei)
- Added array_reduce(), which allows iterative reduction of an array
  to a single value via a callback function.
- Fixed usage of zend_is_callable() in PCRE.
2001-03-12 03:06:53 +00:00
Andi Gutmans
eb6ba01d1c - Fix copyright notices with 2001 2001-02-26 06:11:02 +00:00
Andrei Zmievski
1424e36315 Rename to array_search(). 2001-02-20 14:23:03 +00:00
Jason Greene
1888a98a4b Moved the core of in_array into the function php_search_array, which is called by
in_array and search_array (new)

@ Added search_array which works similar to in_array but returns
@ the key instead of a boolean. (jason@php.net)
2001-02-20 05:36:40 +00:00
Andrei Zmievski
753e46657f Make php_array_merge() an API function. 2000-12-11 05:36:24 +00:00
Andrei Zmievski
a35bf41670 Added array_sum() function. 2000-10-25 17:40:11 +00:00
David Croft
83513d9580 Changed lots of PHP 3 licence headers to PHP 4, mainly in .h files.
Added a few RCS $Id$ tags.

# Note: I have avoided changing any .h files if the corresponding .c file
# had not already been changed as I am not sure if there are any legal
# issues here. So some extensions still have PHP 3 headers.
2000-07-24 01:40:02 +00:00
Andrei Zmievski
3ac0ae9dff @- Improved array_multisort() to be able to specify sort type as well sort
@  order. Incidentally, it can be used to sort multi-dimensional arrays
@  as well. (Andrei)
2000-07-11 16:48:03 +00:00
Sascha Schumann
16017f6d78 Change header protection macros to conform to standard.
Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"

  All identifiers that begin with an underscore and either an uppercase
  letter or another underscore are always reserved for any use by the
  implementation.
2000-07-02 23:46:51 +00:00
Stig Venaas
f18b903d5f Changed array_subtract to array_diff 2000-06-10 19:09:56 +00:00
Stig Venaas
99f151f1bd Adding fuctions array_unique, array_intersect and array_subtract. 2000-06-10 18:58:45 +00:00
Andrei Zmievski
01a4220954 @- Added array_merge_recursive() that will recursively merge values
@  under the same keys. (Andrei)
2000-05-30 17:03:56 +00:00
Zeev Suraski
e043439ff6 Update the license with the new clause 6 2000-05-18 15:34:45 +00:00
Andrei Zmievski
a859e83392 Update for sort functions - user can now specify sort type. 2000-05-18 00:47:57 +00:00
Andrei Zmievski
fdbea075fa @- Added array_rand() function. (Andrei) 2000-05-09 19:27:00 +00:00
Andrei Zmievski
c7100c4a1a Added natural comparison/sorting routines using code from Martin Pool.
@- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(),
@  natsort(), and natcasesort(). These are useful for comparing and sorting
@  strings that contain numbers. Based on the code from Martin Pool
@  <mbp@humbug.org.au>. See http://www.linuxcare.com.au/projects/natsort/
@  for more info on natural sorting. (Andrei)
2000-04-12 19:39:02 +00:00