This implements the original functionality of php_splice, but
as an in-place operation, thus avoiding copying the HT.
This is much faster (~10x) if the splice removes a small portion
of the array and doesn't insert many elements.
* pull-request/257:
array_column: Fix compile-time warnings
array_column: Removed array_pluck() alias
array_column: Set array_pluck as an alias for array_column
array_column: Implement ability to specify an index column
Cleaning up a memory leak.
array_column: Adding test for IS_OBJECT and converting object to string
array_column: Using add_next_index_zval() at nikic's recommendation.
array_column: Improved tests
array_column: Cleaning up, as recommended in pull request #56 comments
Fixing typo in test for array_column()
Simplify the code and use zend_hash_next_index_insert()
Adding test for columns not present in all rows for array_column().
Adding tests for the negative results of array_column()
Implement new array function array_column()
. Folding tags
. Parameter parsing
. SPL debug info
. array function improvements (not all yet)
. Improvements to function calling with call_user_* functions
. Improvements to debugging info in var_dump/print_r
# I propably forgot already something but this all was pretty close tied
# to each other so it wasn't possible to do it in parts.
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.
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.
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).
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.
@- 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.