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