Function __global->substr_replace

Definitions

sources_custom/phpstub.php

  • Replace text within a portion of a string.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$string string No No required parameter N/A N/A The subject string
$replacement string No No required parameter N/A N/A The replacement string
$start integer No No required parameter N/A N/A The start position of what's being replaced
$length ?integer No No Null N/A N/A The run-length of what is being replaced (null: go to end of string)

Returns

  • A copy of string delimited by the start and (optionally) length parameters with the string given in replacement
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Replace text within a portion of a string.
 *
 * @param  string $string The subject string
 * @param  string $replacement The replacement string
 * @param  integer $start The start position of what's being replaced
 * @param  ?integer $length The run-length of what is being replaced (null: go to end of string)
 * @return string A copy of string delimited by the start and (optionally) length parameters with the string given in replacement
 */

function substr_replace(string $string, string $replacement, int $start, ?int $length = null) : string