返回介绍

_deep_replace()

发布于 2017-09-11 13:18:44 字数 1988 浏览 954 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_deep_replace( string|array $search,  string $subject )

Perform a deep string replace operation to ensure the values in $search are no longer present


description

Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values e.g. $subject = ‘%0%0%0DDD’, $search =’%0D’, $result =” rather than the ‘%0%0DD’ that str_replace would return


参数

$search

(string|array) (Required) The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.

$subject

(string) (Required) The string being searched and replaced on, otherwise known as the haystack.


返回值

(string) The string with the replaced svalues.


源代码

File: wp-includes/formatting.php

function _deep_replace( $search, $subject ) {
	$subject = (string) $subject;

	$count = 1;
	while ( $count ) {
		$subject = str_replace( $search, '', $subject, $count );
	}

	return $subject;
}

更新日志

Versiondescription
2.8.1Introduced.

相关函数

Used By

  • wp-includes/formatting.php: esc_url()
  • wp-includes/pluggable.php: wp_sanitize_redirect()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文