Usephul

usephul

Table of Contents

Namespaces

Enumerations
generators
math
Path
Sorting
type
var

Constants

E_EVERYTHING  = 0x7fffffff
This mask matches every possible past and future PHP error level.

Functions

array_interchange()  : array<string|int, mixed>
Interchange the values of two elements of an array.
array_remap()  : array<string|int, mixed>
Applies a (generator) callback to the elements of a given array, allowing the remapping of its keys in the process.
array_zip()  : array<string|int, array<string|int, TValue>>
Perform a zip operation on multiple arrays.
class_parents_uses()  : array<class-string, class-string>|false
Return the traits used by the parent classes of the given class.
class_parents_traits_uses()  : array<class-string, class-string>|false
Return the traits used by the parent classes of the given class, recursively.
class_traits_uses()  : array<class-string, class-string>|false
Return the traits used by the given class or trait, recursively.

Constants

E_EVERYTHING

This mask matches every possible past and future PHP error level.

public mixed E_EVERYTHING = 0x7fffffff

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>

array_remap()

Applies a (generator) callback to the elements of a given array, allowing the remapping of its keys in the process.

array_remap(callable(TKey $key, TValue $value): mixed $callback, array<string|int, mixed> $array) : array<string|int, mixed>

array_remap() returns an array containing the results of applying a callback with the corresponding key and value of array used as arguments.

If callback is a generator function, then it's possible to provide a new key for the resulting array element using yield from $key => $value.

If the same key is yielded more than once, then the later yield will override the previous one.

Parameters
$callback : callable(TKey $key, TValue $value): mixed

A callable to run for each key-value pair in the array.

$array : array<string|int, mixed>
Return values
array<string|int, mixed>
      Returns an array containing the results of applying the

callback* function to the corresponding key-value pair of array* used as arguments for the callback.

array_zip()

Perform a zip operation on multiple arrays.

array_zip(array<string|int, TValue$array, array<string|int, TValue...$arrays) : array<string|int, array<string|int, TValue>>
Parameters
$array : array<string|int, TValue>

An array to zip.

$arrays : array<string|int, TValue>

Supplementary list of array arguments to zip.

Return values
array<string|int, array<string|int, TValue>>

Returns an array whose elements are each an array holding the elements of the input arrays of the same index.

class_parents_uses()

Return the traits used by the parent classes of the given class.

class_parents_uses(object|string $object_or_class[, bool $autoload = true ]) : array<class-string, class-string>|false

This function returns an array with the names of the traits that the parents of the given object_or_class use.

Parameters
$object_or_class : object|string

An object or class name.

$autoload : bool = true

Whether to autoload if not already loaded.

Return values
array<class-string, class-string>|false

An array on success, or false when the class doesn't exist.

class_parents_traits_uses()

Return the traits used by the parent classes of the given class, recursively.

class_parents_traits_uses(object|string $object_or_class[, bool $autoload = true ]) : array<class-string, class-string>|false

This function returns an array with the names of the traits that the parent classes of the given object_or_class uses, including traits used within those traits.

Parameters
$object_or_class : object|string

An object or class name.

$autoload : bool = true

Whether to autoload if not already loaded.

Return values
array<class-string, class-string>|false

An array on success, or false when the class doesn't exist.

class_traits_uses()

Return the traits used by the given class or trait, recursively.

class_traits_uses(object|string $object_or_class[, bool $autoload = true ]) : array<class-string, class-string>|false

This function returns an array with the names of the traits that the given object_or_class uses, including traits used by those traits, recursively. This does however not include any traits used by a parent class.

Parameters
$object_or_class : object|string

An object, class name or trait name.

$autoload : bool = true

Whether to autoload if not already loaded.

Return values
array<class-string, class-string>|false

An array on success, or false when the class doesn't exist.


        
On this page

Search results