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

WordPress Trac noreply at wordpress.org
Fri Oct 5 13:37:16 UTC 2018


#45055: Introduce new PHP cross-version compatibility functions,
`array_key_first()`, `array_key_last()`
-----------------------------+----------------------------
 Reporter:  desrosj          |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Future Release
Component:  General          |    Version:
 Severity:  normal           |   Keywords:  needs-patch
  Focuses:                   |
-----------------------------+----------------------------
 PHP 7.3 will introduce two new functions, `array_key_first()`, and
 `array_key_last()`. The two functions return the first and last key of
 each array respectively, ''without'' affecting the internal state of the
 array (`reset()`, `end()` and `key()` do). The full RFC can be read here:
 [https://wiki.php.net/rfc/array_key_first_last]

 Including a polyfill would allow developers to take advantage of the new
 functions and write consistent code regardless of a site's PHP version.
 While polyfills for these two functions are not required for WordPress to
 be PHP 7.3 compatible, it could be added in the version after 7.3
 compatibility is declared.

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


More information about the wp-trac mailing list