Skip to content

Commit 3476790

Browse files
Coding Standards: Replace an empty foreach loop in wp_replace_in_html_tags().
This aims to clarify the intention of the code and improve readability. Follow-up to [33359]. Props jrf, TobiasBg, mi5t4n, dhruvang21, mayura8991, nadimcse, Presskopp, SergeyBiryukov. Fixes #61860. git-svn-id: https://develop.svn.wordpress.org/trunk@58889 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5f8f378 commit 3476790

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wp-includes/formatting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,8 @@ function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
762762
// Optimize when searching for one item.
763763
if ( 1 === count( $replace_pairs ) ) {
764764
// Extract $needle and $replace.
765-
foreach ( $replace_pairs as $needle => $replace ) {
766-
}
765+
$needle = array_key_first( $replace_pairs );
766+
$replace = $replace_pairs[ $needle ];
767767

768768
// Loop through delimiters (elements) only.
769769
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {

0 commit comments

Comments
 (0)