Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 592 Bytes

str_random.md

File metadata and controls

47 lines (29 loc) · 592 Bytes

Description

Creates a string of random characters

str_random(int $length, string $alphabet): string

Parameters

length

The length of the returned string

length

The characters allowed in the result

Returns

A random string of length with characters from the alphabet.

Examples

Example # 1 Example uses of str_random()

echo str_random(5);

The above example may output:

uwceb

Example # 2 Example uses of str_random() with a custom alphabet

echo str_random(5, 'def');

The above example may output:

ddefe