php 字符串的一些操作,以便记忆
2024-10-19 06:21:53
php 字符串的操作
- trim($str,'特殊字符')-----去除字符串左右两边的字符,返回字符串
- ltrim(),rtrim()--------------------左,由两边,与trim()类似;
- addslashes($str)--------------为字符串加入斜线,两侧,返回字符串
- stripslashes($str)-------------将addslashes()的字符返回原样
- strlen($str)-----------------------返回长度
- substrate(string str,int start[,int length)-------------截取从stat开始,长度为length的字符串
- strcmp(string str1,string str2)------比较字符串大小,区分大小写,返回值1,0,1
- strcasecmp(string str1,string str2)----比较大小,不区分大小写,返回值1,0,1
- strnatcmp(string str1,string str2)-------自然排序法,区分大小写
- strncmp(string str1,string str2,int len)-比较字符串中长度为len的字符
- strstr(string haystack,string needle)-返回needdle在haystack首次出现的位置到末尾的子字符串
- str_ireplace(mix search,mix replace,mix subject[,int&count]),用replace替换subject中search,count代表替换次数)
- substr_replace(string str,string repl,int start,[int length])--用repl代替str中他位置开始长度为count的字符串
- explode('拆分',str);
- impode('区分',arr);
最新文章
- C++文件读写详解
- linux 错误处理
- .NET Framework Execution Was Aborted By Escalation Policy
- apache 开启服务器包含(SSI)技术
- h5拖放-拖拽购物车
- 让工程师爱上CMM,实现管理于无形 --- 中标软件CMMI L5之路 (2/2)
- zf-关于公司框架的时间字段的格式转换问题。。
- volatile的理解和使用
- 拨开字符编码的迷雾--MySQL数据库字符编码
- mybatis入门篇基——基本配置与参数说明
- ruby中__FILE__,$FILENAME,$PROGRAM_NAME,$0等类似变量的含义
- TensorFlow.org教程笔记(一)Tensorflow初上手
- ad 线束和网络
- JAVA基础-输入输出流
- 添加php的memcached扩展模块
- HUST1017(KB3-A Dancing links)
- 004-spring cloud gateway-网关请求处理过程
- python服务器端、客户端的模型,客服端发送请求,服务端进行响应(web.py)
- java Exception 出错的栈信息打印到日志中 打印堆栈信息
- 科普Spark,Spark核心是什么,如何使用Spark(1)
热门文章
- OpenStack neutron删除网络设备出错解决办法
- leetcode_438_Find All Anagrams in a String_哈希表_java实现
- #include <;NOIP2009 Junior>; 细胞分裂 ——using namespace wxl;
- 《TCP/IP 详解 卷一》读书笔记-----Ping&;Traceroute
- codeforces 712B B. Memory and Trident(水题)
- python刷题专用函数。。
- Vector3.Dot 判断方位
- java9-3 返回类型
- Python 栅栏凯撒
- C# 使用正则表达式去掉字符串中的数字,或者去掉字符串中的非数字