Documentation

Helpers
in package

Table of Contents

Constants

IsWindows  = PHP_OS_FAMILY === 'Windows'

Methods

capture()  : string
Executes a callback and returns the captured output as a string.
clamp()  : int|float
Returns value clamped to the inclusive range of min and max.
compare()  : bool
Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <>
falseToNull()  : mixed
Converts false to null, does not change other values.
getLastError()  : string
Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), it is nit affected by the PHP directive html_errors and always returns text, not HTML.
getSuggestion()  : string|null
Looks for a string from possibilities that is most similar to value, but not the same (for 8-bit encoding).

Constants

IsWindows

public mixed IsWindows = PHP_OS_FAMILY === 'Windows'

Methods

capture()

Executes a callback and returns the captured output as a string.

public static capture(callable $func) : string
Parameters
$func : callable
Return values
string

clamp()

Returns value clamped to the inclusive range of min and max.

public static clamp(int|float $value, int|float $min, int|float $max) : int|float
Parameters
$value : int|float
$min : int|float
$max : int|float
Return values
int|float

compare()

Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <>

public static compare(mixed $left, string $operator, mixed $right) : bool
Parameters
$left : mixed
$operator : string
$right : mixed
Return values
bool

falseToNull()

Converts false to null, does not change other values.

public static falseToNull(mixed $value) : mixed
Parameters
$value : mixed

getLastError()

Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), it is nit affected by the PHP directive html_errors and always returns text, not HTML.

public static getLastError() : string
Return values
string

getSuggestion()

Looks for a string from possibilities that is most similar to value, but not the same (for 8-bit encoding).

public static getSuggestion(array<string|int, string> $possibilities, string $value) : string|null
Parameters
$possibilities : array<string|int, string>
$value : string
Return values
string|null

        
On this page

Search results