Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #54385, comment 33


Ignore:
Timestamp:
11/19/2021 10:41:04 PM (3 years ago)
Author:
stevegs
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54385, comment 33

    initial v1  
    99> Thanks for the feedback @stevegs and @TobiasBg...  re: `str_contains`, in the latest patch I use `substr_count( $str, '/' )` to ensure the string contains one and only one `/` which @jrf suggested on the PR. What do you think?
    1010
    11 This seems to be the most elegant solution.  I've checked that `substr_count('2//5', '/')` returns 2, as does `substr_count('2/24/5', '/')` - so it will catch more than one / whether consecutive or not.  And it's backward compatible with PHP7.
     11This seems to be the most elegant solution.  I've checked that `substr_count('2//5', '/')` returns 2, as does `substr_count('2/24/5', '/')` - so it will catch more than one `/` whether consecutive or not.  And it's backward compatible with PHP7.