Function __global->override_str_replace_exactly
Definitions
sources/global.php
- Replace a limited number of occurrences of the search string with the replacement string.If there are the wrong number of occurrences (including zero) an error is put out, as this indicates an override is broken.The phrase "<ditto>" will repeat the original $search string back into $replace.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $search | mixed | No | No | required parameter | N/A | N/A | What's being replaced (string or array) |
| $replace | mixed | No | No | required parameter | N/A | N/A | What's being replaced with (string or array) |
| $subject | mixed | No | No | required parameter | N/A | N/A | Subject (string or array) |
| $times | integer | No | No | 1 | N/A | N/A | Number of times to replace (to expect to replace) |
| $fail_ok | boolean | No | No | False | N/A | N/A | Whether a failure should attach a message and return the original code (false: a failure should cause a critical error) |
Returns
- Result (string or array)
- Type: mixed
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Replace a limited number of occurrences of the search string with the replacement string.If there are the wrong number of occurrences (including zero) an error is put out, as this indicates an override is broken.The phrase "<ditto>" will repeat the original $search string back into $replace.
*
* @param mixed $search What's being replaced (string or array)
* @param mixed $replace What's being replaced with (string or array)
* @param mixed $subject Subject (string or array)
* @param integer $times Number of times to replace (to expect to replace)
* @param boolean $fail_ok Whether a failure should attach a message and return the original code (false: a failure should cause a critical error)
* @return mixed Result (string or array)
*/
function override_str_replace_exactly($search, $replace, $subject, int $times = 1, bool $fail_ok = false)
* Replace a limited number of occurrences of the search string with the replacement string.If there are the wrong number of occurrences (including zero) an error is put out, as this indicates an override is broken.The phrase "<ditto>" will repeat the original $search string back into $replace.
*
* @param mixed $search What's being replaced (string or array)
* @param mixed $replace What's being replaced with (string or array)
* @param mixed $subject Subject (string or array)
* @param integer $times Number of times to replace (to expect to replace)
* @param boolean $fail_ok Whether a failure should attach a message and return the original code (false: a failure should cause a critical error)
* @return mixed Result (string or array)
*/
function override_str_replace_exactly($search, $replace, $subject, int $times = 1, bool $fail_ok = false)

