参数 | 描述 |
---|---|
string | 必需。规定要返回其中一部分的字符串。 |
start |
必需。规定在字符串的何处开始。
|
charlist |
可选。规定要返回的字符串长度。默认是直到字符串的结尾。
|
注释:如果 start 是负数且 length 小于等于 start,则 length 为 0。
<?php
echo substr("Hello world!",6)
;
?>
输出:
world!
<?php
echo substr("Hello world!",6,5)
;
?>
输出:
world
制作:
http://www.7di.net 生活网搜集整理 参考: http://www.w3school.com.cn/php/func_string_substr.asp |