WP_MatchesMapRegex::callback() WordPress Method

The WP_MatchesMapRegex::callback() method is used to call a callback function for each matched element in a regular expression map. This is useful for performing operations on a set of matched elements, such as formatting or converting them.

WP_MatchesMapRegex::callback( array $matches ) #

preg_replace_callback hook


Parameters

$matches

(array)(Required)preg_replace regexp matches


Top ↑

Return

(string)


Top ↑

Source

File: wp-includes/class-wp-matchesmapregex.php

	public function callback( $matches ) {
		$index = (int) substr( $matches[0], 9, -1 );
		return ( isset( $this->_matches[ $index ] ) ? urlencode( $this->_matches[ $index ] ) : '' );
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.