Function __global->preg_replace_callback

Definitions

sources_custom/phpstub.php

  • Perform a regular expression search and replace using a callback.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$pattern string No No required parameter N/A N/A The pattern
$callback mixed No No required parameter N/A N/A The callback
$subject string No No required parameter N/A N/A The subject string
$limit integer No No -1 N/A N/A The limit of replacements (-1: no limit)
&$count integer Yes No 0 N/A N/A Number of replacements made

Returns

  • The string with replacements made (null: error)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Perform a regular expression search and replace using a callback.
 *
 * @param  string $pattern The pattern
 * @param  mixed $callback The callback
 * @param  string $subject The subject string
 * @param  integer $limit The limit of replacements (-1: no limit)
 * @param  integer $count Number of replacements made
 * @return ?string The string with replacements made (null: error)
 */

function preg_replace_callback(string $pattern, $callback, string $subject, int $limit = -1, int &$count = 0) : ?string