php获取字符串的前5个字符
$result = substr("Hello How are you", 0, 5); //first 5 chars "Hello"
取后四位数字
$newstring = substr($dynamicstring, -7);
从字符串php中获取第一个单词
function getFirstWord($string)
{
$arr = explode(' ', trim($string));
return isset($arr[0]) ? $arr[0] : $string;
}