Generate a random string with the specified length. Optionally you can set the chars to use for generate the string.
require 'generate_string.php';
// Normal usage:
printf('<p>Random string: %s</p>', generate_string('5'));
// Generating a password
printf('<p>Password: %s</p>', generate_string('8', '!@#$%:;=()-_/.?=abcdefghkmnpqrstuvwxyzABCDEFGHKMNPQRSTUVWXYZ0987654321!@#$%:;=()-_/.?='));