[wp-trac] [WordPress Trac] #63853: Add PHP 8.5 compat array functions: `array_first` and `array_last`

WordPress Trac noreply at wordpress.org
Wed Aug 27 07:40:50 UTC 2025


#63853: Add PHP 8.5 compat array functions: `array_first` and `array_last`
-------------------------------------------------+-------------------------
 Reporter:  TobiasBg                             |       Owner:  jorbin
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.9
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  php85 has-patch has-unit-tests       |     Focuses:  php-
  commit                                         |  compatibility
-------------------------------------------------+-------------------------

Comment (by Soean):

 In `array_first()` we could use
 {{{#!php
 return $array[ array_key_first( $array ) ];
 }}}

 instead of

 {{{#!php

 foreach ( $array as $value ) {
         return $value;
 }
 }}}

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


More information about the wp-trac mailing list