- sscanf: documentation ( source)
- var_export: documentation ( source)
- random_int: documentation ( source)
- strtolower: documentation ( source)
- sprintf: documentation ( source)
<?php
function random_username($string) {
sscanf(strtolower($string), '%s %2s', $first, $second);
return sprintf('%s%s%d', $first, $second, random_int(0, 100));
}
var_export(random_username("Mike Test"));