Documentation

FormatsTrait

Trait FormatsTrait - Some useful functions

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Methods

getmin()  : int
Gets the minimum of three (usually numeric) values $x, $y, and $z.
intrim()  : mixed
Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.
left()  : bool|string
Returns the first $numchars characters of a string.
rem_right()  : bool|string
Removes $charcount characters from the right (end) of a string.
right()  : bool|string
Returns the substring beginning at $numchars characters from the right end of a string.
trim_element()  : mixed
trim_element() removes leading and trailing spaces from a string. In conjunction with the array_walk() function, it removes spaces from each element of an array.

Methods

getmin()

Gets the minimum of three (usually numeric) values $x, $y, and $z.

public getmin(int $x, int $y, int $z) : int

For now, this can't handle situations when one or more arguments is FALSE.

Parameters
$x : int
$y : int
$z : int
Return values
int

intrim()

Removes "internal spaces" (as opposed to leading and trailing spaces) from a string.

public intrim(string $string) : mixed
Parameters
$string : string

left()

Returns the first $numchars characters of a string.

public left(string $str, int $numchars) : bool|string
Parameters
$str : string
$numchars : int
Return values
bool|string

rem_right()

Removes $charcount characters from the right (end) of a string.

public rem_right(string $str[, int $charcount = 1 ]) : bool|string
Parameters
$str : string
$charcount : int = 1
Return values
bool|string

right()

Returns the substring beginning at $numchars characters from the right end of a string.

public right(string $str, int $numchars) : bool|string
Parameters
$str : string
$numchars : int
Return values
bool|string

trim_element()

trim_element() removes leading and trailing spaces from a string. In conjunction with the array_walk() function, it removes spaces from each element of an array.

public trim_element(mixed &$value, mixed $key) : mixed
Parameters
$value : mixed
$key : mixed
On this page

Search results