0%

PHP常用字符串处理函数

截取子串:substr 格式化输出:printf 换行符\n转成HTML的br:nl2br 指定位置强制换行:wordwrap 转换为小写:strtolower 转换为大写:strtoupper 字符串中所有单词首字符大写:ucwords 计算字符串长度:strlen 计算子串出现的次数:substr_count,str_word_count 查找子串索引:strpos 字符串复制:str_repeat 字符串翻转:strrev 字符串替换:substr_replace 切割字符串:explode,str_split 数组元素连接成字符串:implode 字符串比较:==(比Java简单),strcmp