class Str

Methods

static string
remove_accents(string $string)

Removes accents from string

static string
remove_symbols(string $string, array $except = [])

Removes anything that is not a letter, number, or space

static string
sanitize_string(string $string, string $space = "", array $include_chars = [])

Removes accents, makes string lowercase, replaces multiple spaces with $space

static string
rand_str(int $length = 40)

Generates a random string of $lengh length

static string
rand_letters_string(int $length = 10)

Generates an only letters string of $lenght length

static void
remove_spaces(string $subject, string $replace = "")

Remove all spaces from given string

Details

at line 12
static string remove_accents(string $string)

Removes accents from string

Parameters

string $string

Return Value

string

at line 32
static string remove_symbols(string $string, array $except = [])

Removes anything that is not a letter, number, or space

Parameters

string $string
array $except

Characters to keep

Return Value

string

at line 48
static string sanitize_string(string $string, string $space = "", array $include_chars = [])

Removes accents, makes string lowercase, replaces multiple spaces with $space

Parameters

string $string
string $space

Character to replace spaces

array $include_chars

Array => value pairs for additional substitutions

Return Value

string

Sanitized string

at line 76
static string rand_str(int $length = 40)

Generates a random string of $lengh length

Max length 40 chars. To be used for purposes where safety is not necessary.

Parameters

int $length

Return Value

string

at line 91
static string rand_letters_string(int $length = 10)

Generates an only letters string of $lenght length

To be used for purposes where safety is not necessary. Eg. For the id of an HTML element.

Parameters

int $length

The length

Return Value

string

at line 102
static void remove_spaces(string $subject, string $replace = "")

Remove all spaces from given string

Parameters

string $subject

The subject string

string $replace

Optional replace for spacing

Return Value

void