PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); function initials(string $fullName): string { if(strpos($fullName,'.')){ return $fullName; } [$firstName,$midlName,$lastName] = explode(' ', $fullName); $initials = $firstName ; $initials .= $midlName[0] ? ' '.$midlName[0].'.' : ''; $initials .= $lastName[0] ? $lastName[0].'.' : ''; return $initials; } echo initials('Sailet GOD fkjjfkw');
Show:  
Copy Clear