explode — 使用一个字符串分割另一个字符串

array explode ( string $delimiter , string $string [, int $limit ] )

implode — 将一个一维数组的值转化为字符串

string implode ( string $glue , array $pieces )

htmlspecialchars — 将特殊字符转换为 HTML 实体  (XXS)

string htmlspecialchars ( string $string )

htmlspecialchars_decode — 将特殊的 HTML 实体转换回普通字符 (与 htmlspecialchars 相反)

string htmlspecialchars_decode ( string $string )

strip_tags — 从字符串中去除 HTML 和 PHP 标记(和htmlspecialchars不同的是 strip_tags 是直接去除标记,而前者是转义成另外的字符) 

string strip_tags ( string $str [, string $allowable_tags ] )

md5 — 计算字符串的 MD5 散列值

string md5 ( string $str [, bool $raw_output = false ] )

nl2br — 在字符串所有新行之前插入 HTML 换行标记 (能将浏览器不能识别的 \n 或者 \r\n 转化成 </br>)

string nl2br ( string $string [, bool $is_xhtml = TRUE ] )

trim — 去除字符串首尾处的空白字符(或者其他字符)

string trim ( string $str [, string $character_mask = " \t\n\r\0\x0B" ] )

strpos — 查找字符串首次出现的位置(stripos 不区分大小写)(通常用于判断字符串中是否包含另一个字符串

int stripos ( string $haystack , string $needle [, int $offset = 0 ] )

strrpos — 计算指定字符串在目标字符串中最后一次出现的位置

int strrpos ( string $haystack , string $needle [, int $offset = 0 ] )

strstr — 查找字符串的首次出现 返回第一次出现的位置开始到 haystack 结尾的字符串

string strstr ( string $haystack , mixed $needle [, bool $before_needle = FALSE ] )

strrchr — 查找指定字符在字符串中的最后一次出现

string strrchr ( string $haystack , mixed $needle )

strlen — 获取字符串长度(也可以用来判断字符串是否为空)

int strlen ( string $string )

strtolower — 将字符串转化为小写

string strtolower ( string $string )

strtoupper — 将字符串转化为大写

string strtoupper ( string $string )

substr_count — 计算字串出现的次数

int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] )

substr — 返回字符串的子串(返回字符串 string 由 start 和 lenth 参数指定的子字符串)

string substr ( string $string , int $start [, int $length ] )

str_replace — 子字符串替换(忽略大小写请用 str_ireplace

mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )

search

查找的目标值,也就是 needle。一个数组可以指定多个目标。

replace

search 的替换值。一个数组可以被用来指定多重替换。

subject

执行替换的数组或者字符串。也就是 haystack

如果 subject 是一个数组,替换操作将遍历整个 subject,返回值也将是一个数组。

count

如果被指定,它的值将被设置为替换发生的次数。

<基础> PHP 字符串操作的更多相关文章

  1. python学习笔记(字符串操作、字典操作、三级菜单实例)

    字符串操作 name = "alex" print(name.capitalize()) #首字母大写 name = "my name is alex" pri ...

  2. shell编程常用的截取字符串操作

    1.          常用的字符串操作 1.1.           替换字符串:$ echo ${var/ /_}#支持正怎表达式 / /表示搜索到第一个替换,// /表示搜索到的结果全部替换. ...

  3. php字符串操作集锦

    web操作, 主要就是对字符文本信息进行处理, 所以, 字符串操作几乎占了很大一部分的php操作.包括 注意strstr 和 strtr的区别? 前者表示字符串查找返回字符串,后者表示字符串中字符替换 ...

  4. java 字符串操作和日期操作

    一.字符串操作 创建字符串 String s2 = new String("Hello World"); String s1 = "Hello World"; ...

  5. [No000078]Python3 字符串操作

    #!/usr/bin/env python3 # -*- coding: utf-8 -*- '''Python 字符串操作 string替换.删除.截取.复制.连接.比较.查找.包含.大小写转换.分 ...

  6. Python 字符串操作及string模块使用

    python的字符串操作通过2部分的方法函数基本上就可以解决所有的字符串操作需求: python的字符串属性函数 python的string模块 1.字符串属性方法操作: 1.>字符串格式输出对 ...

  7. C语言字符串操作总结大全

    1)字符串操作 strcpy(p, p1)  复制字符串  函数原型strncpy(p, p1, n)   复制指定长度字符串  函数原型strcat(p, p1)   附加字符串  函数原型strn ...

  8. c# 字符串操作

    一.字符串操作 //字符串转数组 string mystring="this is a string" char[] mychars=mystring.ToCharArray(); ...

  9. C语言字符串操作总结大全(超详细)

    本篇文章是对C语言字符串操作进行了详细的总结分析,需要的朋友参考下 1)字符串操作  strcpy(p, p1) 复制字符串  strncpy(p, p1, n) 复制指定长度字符串  strcat( ...

  10. JavaScript中常见的字符串操作函数及用法

    JavaScript中常见的字符串操作函数及用法 最近几次参加前端实习生招聘的笔试,发现很多笔试题都会考到字符串的处理,比方说去哪儿网笔试题.淘宝的笔试题等.如果你经常参加笔试或者也是一个过来人,相信 ...

随机推荐

  1. C++中sort函数小结

    我们都知道,sort函数是C++标准库<algorithm>中的一个库函数.它的功能是对数组/容器中的元素进行排序.用法示例如下: 一.对数组进行排序 示例: int a[] = {1,3 ...

  2. Quartz不用配置文件配置启动

    StdSchedulerFactory schedulerFactory = null; try { schedulerFactory = new StdSchedulerFactory(); Pro ...

  3. Android 引用库项目,Debug 库项目

    转自:http://www.cnblogs.com/xitang/p/3615768.html#commentform 使用引用项目,无法追到源代码,无法Debug库项目The JAR of this ...

  4. Ubuntu 14.10 下ZooKeeper+Hadoop2.6.0+HBase1.0.0 的HA机群高可用配置

    1 硬件环境 Ubuntu 14.10 64位 2 软件环境 openjdk-7-jdk hadoop 2.6.0 zookeeper-3.4.6 hbase-1.0.0 3 机群规划 3.1 zoo ...

  5. Android开发之内部类篇

    内部类: 1.内部类的第一个好处,隐藏你不想让别人知道的操作,也即封装性. 2.非静态内部类对象有着指向其外部类对象的引用 等等. 创建项目: 1.File---->New----->ja ...

  6. Unable to load native-hadoop library for your platform... using builtin-java classes where applicable(四十四)

    问题描述: Unable to load native-hadoop library for your platform... using builtin-java classes where app ...

  7. Dubbo(2)发布Dubbo服务

    主要参考Dubbo源码包里面的dubbo-demo源码: 1.项目结构: 2.pom.xml中的依赖: <project xmlns="http://maven.apache.org/ ...

  8. RPM安装MYSQL5.7

    RPM安装MYSQL5.7 1:YUM安装依赖库 yum install perl libaio numactl 2:下载安装需要的RPM包 https://dev.mysql.com/get/Dow ...

  9. random模块常用功能

  10. [UE4]UE4是单线程的吗?

    并行与串行 并行是同时在执行,串行是一个接一个地执行 进程与线程 笼统的说,进程是游戏的一次运行,线程是进程里面分配CPU资源的最小单位 类比 1.把世界看成一台计算机 2.世界里面的人可以看成是一个 ...