WordPress Hosting
Free Photos
WordPress Themes

Get the first letter of a string with PHP

<?php function ywt_get_first_char($str) { if($str) return strtolower(substr($str, 0, 1)); return false; } echo ywt_get_first_char('Hello'); //print H ?>
This code snippet will show you how to get the first letter of a string using PHP.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.