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

WordPress Trac noreply at wordpress.org
Mon Nov 8 14:21:58 UTC 2021


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

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


Comment:

 In [changeset:"52040" 52040]:
 {{{
 #!CommitTicketReference repository="" revision="52040"
 General: Introduce polyfills for `str_ends_with()` and `str_starts_with()`
 added in PHP 8.0.

 PHP 8.0 introduced two new functions: `str_ends_with()` and
 `str_starts_with()`. These perform a case-sensitive check indicating if
 the string to search in (haystack) ends or begins with the given substring
 (needle).

 These polyfills make these functios available for use in Core.

 Ref:
 * PHP RFC
 https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions
 * PHP manual `str_ends_with()` https://www.php.net/manual/en/function.str-
 ends-with.php
 * PHP manual `str_starts_with()`  https://www.php.net/manual/en/function
 .str-starts-with.php

 Props costdev, hellofromTonya, pbearne, pbiron.
 Fixes #54377.
 }}}

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


More information about the wp-trac mailing list