functions.php
Tags
Table of Contents
Functions
- array_interchange() : array<string|int, mixed>
- Interchange the values of two elements of an array.
- is_closed_resource() : mixed
- Finds whether the given variable is a {@link https://www.php.net/types.resource resource} that has been closed.
- is_zero() : bool
- Finds whether the given number is (sufficiently close to) 0.
- seq() : Generator<string|int, string|int>
- Sequences a value into a {@see \Generator}.
Functions
array_interchange()
Interchange the values of two elements of an array.
array_interchange(array<string|int, mixed> $array, TKey $key1, TKey $key2) : array<string|int, mixed>
If a key doesn't exist in the array, then the other key will be set
to null
, and a warning will be thrown.
Parameters
- $array : array<string|int, mixed>
- $key1 : TKey
- $key2 : TKey
Return values
array<string|int, mixed>is_closed_resource()
Finds whether the given variable is a {@link https://www.php.net/types.resource resource} that has been closed.
is_closed_resource(T $value) : mixed
Parameters
- $value : T
-
The variable being evaluated.
Return values
mixed —Returns true
if value is a
resource variable that has been
closed, false
otherwise.
is_zero()
Finds whether the given number is (sufficiently close to) 0.
is_zero(int|float $value[, float|null $tolerance = PHP_ZERO_TOLERANCE ]) : bool
Parameters
- $value : int|float
-
The number being evaluated.
- $tolerance : float|null = PHP_ZERO_TOLERANCE
-
Tolerance allowed when evaluating the number.
Return values
bool —Returns true if value is (sufficiently close to) 0, false otherwise.
seq()
Sequences a value into a {@see \Generator}.
seq(mixed $value) : Generator<string|int, string|int>
Parameters
- $value : mixed
-
The value to sequence.