- substr: documentation ( source)
- print_r: documentation ( source)
- implode: documentation ( source)
- strtolower: documentation ( source)
- ucfirst: documentation ( source)
<?php
function generateUserFIO(array $names)
{
return implode(
' ',
[
ucfirst(strtolower($names['last_name'])),
(substr($names['first_name'], 1, 1) . '.'),
(substr($names['middle_name'], 1, 1) . '.'),
]
);
}
print_r(generateUserFIO([
'last_name' => 'Гопкало',
'first_name' => 'Никита',
'middle_name' => 'Владимирович',
]));