3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function generateUserFIO(array $names) { return implode( ' ', [ ucfirst(strtolower($names['last_name'])), (substr($names['first_name'], 0, 1) . '.'), (substr($names['middle_name'], 0, 1) . '.'), ] ); } print_r(generateUserFIO([ 'last_name' => 'Гопкало', 'first_name' => 'Никита', 'middle_name' => 'Владимирович', ])); function generateUserFIO(array $names) { return implode( ' ', [ ucfirst(strtolower($names['last_name'])), (substr($names['first_name'], 0, 2) . '.'), (substr($names['middle_name'], 0, 2) . '.'), ] ); } print_r(generateUserFIO([ 'last_name' => 'Гопкало', 'first_name' => 'Никита', 'middle_name' => 'Владимирович', ]));
Output for 5.4.0 - 5.4.17
Fatal error: Cannot redeclare generateUserFIO() (previously declared in /in/7i0o4:2) in /in/7i0o4 on line 30
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected '[' in /in/7i0o4 on line 6
Process exited with code 255.