Split the string into an array of characters.
Twine\Str::characters( [ $mode = Twine\Config\Characters::ALL ] ) : array
$mode | A characters mode flag |
Available characters modes:
Twine\Config\Characters::ALL | Return all characters in the string |
Twine\Config\Characters::UNIQUE | Return each character only once ignoring duplicate characters |
$string = new Twine\Str('john pinkerton');
$characters = $string->characters(); // Returns ['j', 'o', 'h', 'n', ' ', 'p', 'i', 'n', 'k', 'e', 'r', 't', 'o', 'n']
$string = new Twine\Str('john pinkerton');
$characters = $string->characters(Twine\Config\Characters::UNIQUE); // Returns ['j', 'o', 'h', 'n', ' ', 'p', 'i', 'k', 'e', 'r', 't']