Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -4666,10 +4666,10 @@ PHP_FUNCTION(array_column)
zend_long index_long = 0;
bool index_is_null = 1;

ZEND_PARSE_PARAMETERS_START(2, 3)
ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_ARRAY_HT(input)
Z_PARAM_STR_OR_LONG_OR_NULL(column_str, column_long, column_is_null)
Z_PARAM_OPTIONAL
Z_PARAM_STR_OR_LONG_OR_NULL(column_str, column_long, column_is_null)
Z_PARAM_STR_OR_LONG_OR_NULL(index_str, index_long, index_is_null)
ZEND_PARSE_PARAMETERS_END();

Expand Down
2 changes: 1 addition & 1 deletion ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ function array_count_values(array $array): array {}
* @compile-time-eval
* @refcount 1
*/
function array_column(array $array, int|string|null $column_key, int|string|null $index_key = null): array {}
function array_column(array $array, int|string|null $column_key = null, int|string|null $index_key = null): array {}

/**
* @compile-time-eval
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions ext/standard/tests/array/array_column_skip_column_argument.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
parameter $column_key of array_column() is optional
--FILE--
<?php

$array = [['a'], ['b']];
var_dump(array_column($array, index_key: 0));

?>
--EXPECT--
array(2) {
["a"]=>
array(1) {
[0]=>
string(1) "a"
}
["b"]=>
array(1) {
[0]=>
string(1) "b"
}
}
Loading