I'm trying to implement a code to get an initial user name from my database, I put the code in the header section, the problem is that after I input the code the content on my page doesn't appear. Is there something wrong with my code below?
<div class="symbol symbol-light-success btn-dropdown">
<?php
function getProfilePicture($name)
{
$name_slice = explode(' ', $name);
$name_slice = array_filter($name_slice);
$initials = '';
$initials .= (isset($name_slice[0][0])) ? strtoupper($name_slice[0][0]) : '';
$initials .= (isset($name_slice[count($name_slice) - 1][0])) ? strtoupper($name_slice[count($name_slice) - 1][0]) : '';
return '<span class="symbol-label display-5">' . $initials . '</span>';
}
?>
<?php echo getProfilePicture($_SESSION['username']);?>