mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Save one condition
This commit is contained in:
parent
1af91d944a
commit
9aac41753b
1 changed files with 4 additions and 3 deletions
|
@ -2408,13 +2408,14 @@ PHP_FUNCTION(array_slice)
|
|||
length = num_in - offset;
|
||||
}
|
||||
|
||||
/* Initialize returned array */
|
||||
array_init_size(return_value, length > 0 ? (uint32_t)length : 0);
|
||||
|
||||
if (length <= 0) {
|
||||
array_init(return_value);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize returned array */
|
||||
array_init_size(return_value, (uint32_t)length);
|
||||
|
||||
/* Start at the beginning and go until we hit offset */
|
||||
pos = 0;
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue