Split the first letter from variable

前端 未结 4 1098
挽巷
挽巷 2021-01-23 10:17

I need to split the first letter from variable $name. How I can to do it?

$name = $userData[\'name\'];

How I can to get the first letter?

4条回答
  •  生来不讨喜
    2021-01-23 10:35

    You can get the first letter of a string using array syntax!

    $firstletter = $userData['name'][0];
    

提交回复
热议问题