PHP根据指定的位置和长度获得子字符串,PHP的substr函数功能非常强大,不断可以从前往后去子字符串还可以从后往前取字符串
/**
* PHP根据指定的位置和长度获得子字符串
*
* @param
* @arrange 512-笔记网: jb51.cc
**/
$string = "beginning";
print("Position counted from left: ".substr($string,5)."\n");
print("Position counted form right: ".substr($string,-7,3)."\n");
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
输出:Position counted from left: begin
Position counted form right: gin