PHP obtiene los primeros 5 caracteres de la cadena
$result = substr("Hello How are you", 0, 5); //first 5 chars "Hello"
Friendly Hawk
$result = substr("Hello How are you", 0, 5); //first 5 chars "Hello"
$firstStringCharacter = substr("hello", 0, 1);
function getFirstWord($string)
{
$arr = explode(' ', trim($string));
return isset($arr[0]) ? $arr[0] : $string;
}
i love my india