Function __global->insert_code_before__by_linenum
Definitions
sources/override_api.php
- Insert some code into a function in the given code snippet, by line number (before line number).
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: bool
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| &$code | string | Yes | No | required parameter | N/A | N/A | The code |
| $function | string | No | No | required parameter | N/A | N/A | Name of the function |
| $linenum | integer | No | No | required parameter | N/A | N/A | Line number relative to start of function |
| $newcode | string | No | No | required parameter | N/A | N/A | Code to insert |
| $fail_ok | boolean | No | No | False | N/A | N/A | Whether a failure should attach a message (false: a failure should cause a critical error) |
Returns
- Success status if $fail_ok is true
- Type: boolean
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Insert some code into a function in the given code snippet, by line number (before line number).
*
* @param string $code The code
* @param string $function Name of the function
* @param integer $linenum Line number relative to start of function
* @param string $newcode Code to insert
* @param boolean $fail_ok Whether a failure should attach a message (false: a failure should cause a critical error)
* @return boolean Success status if $fail_ok is true
*/
function insert_code_before__by_linenum(string &$code, string $function, int $linenum, string $newcode, bool $fail_ok = false) : bool
* Insert some code into a function in the given code snippet, by line number (before line number).
*
* @param string $code The code
* @param string $function Name of the function
* @param integer $linenum Line number relative to start of function
* @param string $newcode Code to insert
* @param boolean $fail_ok Whether a failure should attach a message (false: a failure should cause a critical error)
* @return boolean Success status if $fail_ok is true
*/
function insert_code_before__by_linenum(string &$code, string $function, int $linenum, string $newcode, bool $fail_ok = false) : bool

