[wp-trac] [WordPress Trac] #45055: Introduce new PHP cross-version compatibility functions, `array_key_first()`, `array_key_last()`

WordPress Trac noreply at wordpress.org
Mon Nov 8 13:50:48 UTC 2021


#45055: Introduce new PHP cross-version compatibility functions,
`array_key_first()`, `array_key_last()`
-------------------------------------------------+-------------------------
 Reporter:  desrosj                              |       Owner:
                                                 |  hellofromTonya
     Type:  feature request                      |      Status:  closed
 Priority:  normal                               |   Milestone:  5.9
Component:  General                              |     Version:  5.1
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  php73 has-patch has-unit-tests       |     Focuses:
  commit                                         |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52038" 52038]:
 {{{
 #!CommitTicketReference repository="" revision="52038"
 General: Introduce polyfills for `array_key_first()` and
 `array_key_last()` added in PHP 7.3.0.

 PHP 7.3.0 introduced two new functions: `array_key_first()` and
 `array_key_last()`. These two functions return the first and last key of
 each array respectively, without affecting the internal state of the
 array.

 The polyfills make these two functions available for use in Core on PHP
 versions less than 7.3.0.

 Ref:
 * PHP RFC https://wiki.php.net/rfc/array_key_first_last
 * PHP manual `array_key_first()` https://www.php.net/manual/en/function
 .array-key-first.php
 * PHP manual `array_key_last()` https://www.php.net/manual/en/function
 .array-key-last.php

 Props desrosj, pbearne, costdev, hellofromTonya, ayeshrajans,
 manzoorwanijk, audrasjb, sergeybiryukov.
 Fixes #45055.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45055#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list