函数文档

_wp_iso_convert()

💡 云策文档标注

概述

_wp_iso_convert() 是一个 WordPress 内部辅助函数,用于将十六进制编码的字符转换为 ASCII 字符。它通常与正则表达式回调函数配合使用。

关键要点

  • 函数接受一个参数 $matches,必须是 preg_replace_callback 返回的匹配数组。
  • 返回转换后的 ASCII 字符字符串。
  • 函数内部使用 strtolower、hexdec 和 chr 函数处理转换。
  • 自 WordPress 3.1.0 版本引入。

代码示例

function _wp_iso_convert( $matches ) {
	return chr( hexdec( strtolower( $matches[1] ) ) );
}

📄 原文内容

Helper function to convert hex encoded chars to ASCII.

Parameters

$matchesarrayrequired
The preg_replace_callback matches array.

Return

string Converted chars.

Source

function _wp_iso_convert( $matches ) {
	return chr( hexdec( strtolower( $matches[1] ) ) );
}

Changelog

Version Description
3.1.0 Introduced.