I need to get the first character of the given string. here i have a name in the session variable. i am passing the variable value to the substr to get the first character of the string. but i couldn't.
i want to get the first character of that string.
for example John doe.  i want to get the first character of the string j. how can i get it using php?
  <?php
      $username = $_SESSION['my_name'];
      $fstchar = substr($username, -1);
  ?>
 
     
     
     
     
     
     
     
     
    