php中有没有向右取字符串的函数?
就像excel里面的right一样。
就像excel里面的right一样。
解决方案 »
- PHP正则表达式过滤有规律的字符串,如何只取出标题部分?
- 如何实现邮箱激活账号!!!!!!
- 如何点iframe里的一个按钮,使父窗体的地址改变
- 搞PHP 现在的工资平均是多少??
- 网站受攻击的日志
- 喜悦国际村 - 请教一个动态变量的问题.对偶来说很有难度,希望高手赐教. 分数可以再加,主要是解决问题.
- who 有php+iis 的网站例子啊??????
- 大家帮忙看一下这个递归函数哪儿错了!
- ———高手赐教阿 !————————
- 求助:Mysq Memory内存引擎存储session的数据表设计
- 关于php连接数据库mysql问题
- Delphi for php DBG Failed to start debug session
(PHP 3, PHP 4, PHP 5)substr -- Return part of a string
Description
string substr ( string string, int start [, int length] )
substr() returns the portion of string specified by the start and length parameters. If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth. 例子 1. Basic substr() usage<?php
echo substr('abcdef', 1); // bcdef
echo substr('abcdef', 1, 3); // bcd
echo substr('abcdef', 0, 4); // abcd
echo substr('abcdef', 0, 8); // abcdef
echo substr('abcdef', -1, 1); // f// Accessing single characters in a string
// can also be achived using "curly braces"
$string = 'abcdef';
echo $string{0}; // a
echo $string{3}; // d
echo $string{strlen($string)-1}; // f?>
If start is negative, the returned string will start at the start'th character from the end of string. 例子 2. Using a negative start<?php
$rest = substr("abcdef", -1); // returns "f"
$rest = substr("abcdef", -2); // returns "ef"
$rest = substr("abcdef", -3, 1); // returns "d"
?>
多看手册!