]> granicus.if.org Git - php/commit
Minor optimizations to array_keys()/array_values()
authorSara Golemon <pollita@php.net>
Tue, 14 Mar 2017 17:30:49 +0000 (10:30 -0700)
committerSara Golemon <pollita@php.net>
Tue, 14 Mar 2017 18:23:02 +0000 (11:23 -0700)
commitc74bc87c74f48bc55541b3bf2fc67d595f58a3b5
treef6a2a477370122232f54f5e95380c42d5d4b28e9
parent16ae9f82e82e2aea5d7deaf8f9a9c825a56dfcc1
Minor optimizations to array_keys()/array_values()

array_values():
When the input is an empty array or a packed array with no gaps,
return the original array.

array_keys():
When the input is an empty array, return the original array.
When the input is a packed array with no holes
(and no search key specified), populate the return with
a simple range(0, count($input) - 1)
NEWS
ext/standard/array.c
ext/standard/tests/array/packed_001.phpt [new file with mode: 0644]