// Press 'Run Code' to execute candidate solution live...
@php
$words = preg_split('/\s+/', trim($interview->candidate_name));
if (count($words) >= 2) {
$candInitials = strtoupper(substr($words[0], 0, 1) . substr(end($words), 0, 1));
} else {
$nameStr = trim($interview->candidate_name);
$candInitials = strtoupper(substr($nameStr, 0, 1) . (strlen($nameStr) > 1 ? substr($nameStr, -1) : ''));
}
@endphp