Performs a deep string replace operation to ensure the values in $search are no longer present.
Repeats the replacement operation until it no longer replaces anything to remove "nested" values e.g. $subject = ‘%0%0%0DDD’, $search =’%0D’, $result ='' rather than the ‘%0%0DD’ that str_replace would return
$searchstring|arrayrequired
$subjectstringrequired
function _deep_replace( $search, $subject ) {
$subject = (string) $subject;
$count = 1;
while ( $count ) {
$subject = str_replace( $search, '', $subject, $count );
}
return $subject;
}
| Version | Description |
|---|---|
| 2.8.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_deep_replace