addslashes

print addslahes ('She said, "Great!"');
#output
#She said, \"Great!\

echo

echo "hello world"
#output
#hello world

explode/implode

#explode
$var = 'Learn PHP';
print_r (explode (' ',$var));
# Result:
# Array ( [0] => Learn [1] => PHP ) #implode
$array1 = array('one','two','three');
print (implode ('+',$array1));
# output
# one+two+three

htmlentities

print htmlentities('<br>An example');

# output
# &lt;br&gt;An example

htmlspecialchars

print htmlspecialchars('Is "this" true? 3 > 2', ENT_NOQUOTES);
# output
# Is "this" true? 3 &gt; 2

md5

print md5('1');

# Result:
# c4ca4238a0b923820dcc509a6f75849b

number_format

number_format (number, [number_of_decimals], [decimal_character], [thousand_separator_character])

print number_format(5432.105, 3, ',', '.');

# Result:
# 5.432,105

str_replace

str_replace ('match_pattern', 'replacement_pattern', 'text', [count])

print str_replace ('str','k','The string replacement function in PHP is str_replace');
#Result:
#The king replacement function in PHP is k_replace

strlen

print strlen('strlen function');
#output
#15

strstr

strstr ('string', 'match_pattern', [before_indicator])

print strstr("PHP strstr function", 'str'); #output 'strstr function'
print strstr("php strstr function", 'str',TRUE) #output 'PHP' [before_indicator]该参数自 php 5.3.0引入

substr

substr ('string', position_start, substr_length)

print substr('PHP substr is a substring function', 5, 3); #output 'ubs'

参考

http://www.1keydata.com/php-tutorial/string-functions.php

http://developer.51cto.com/art/200807/94916.htm

php字符串常用函数的更多相关文章

  1. Excel怎样从一串字符中的某个指定“字符”前后截取字符及截取字符串常用函数

    怎么样可以从一串字符中的某个指定位置的前或后截取指定个数的字符. 如:12345.6789,我要截取小数点前(或后)的3个字符.怎么样操作, 另外,怎么样从右边截取字符,就是和left()函数相反的那 ...

  2. python的基本用法(三)字符串常用函数

    字符串常用函数 # s='.abcd.'# new_s=s.strip('.')#默认去掉字符串两边的空格和换行符,想去掉什么括号中就写什么# print('s',s)# print('new_s', ...

  3. python字符串 常用函数 格式化字符串 字符串替换 制表符 换行符 删除空白 国际货币格式

    # 字符串常用函数# 转大写print('bmw'.upper()) # BMW# 转小写print('BMW'.lower()) # bmw# 首字母大写print('how aae you ?'. ...

  4. SQL Server中截取字符串常用函数

    SQL Server 中截取字符串常用的函数: .LEFT ( character_expression , integer_expression ) 函数说明:LEFT ( '源字符串' , '要截 ...

  5. C 字符/字符串常用函数

    string.h中常用函数 char * strchr(char * str ,char ch); 从字符串str中查找首次出现字符ch的位置,若存在返回查找后的地址,若不存在则返回NULL void ...

  6. golang字符串常用函数

    package utils import "fmt" import "strconv" import "strings" var str s ...

  7. python面试题(二)字符串常用函数

    今天在微信的公众号上看到了一遍python学习开发的文章,里面有一些python的面试题,碰巧最近python不知道学什么了,索性学一下这篇文章啊!!先写一下一些字符串的常用函数.(ps:本人太菜,若 ...

  8. Python 字符串常用函数

    操作字符串的常用函数 函数 描述(返回值) str.capitalize() 将字符串的第一个字符大写 str.title() 返回标题化的字符串,即每个单词的首字母都大写 str.upper() 全 ...

  9. php 字符串常用函数

    数组.字符串和数据库是我们函数里面最.最.最常用的三类函数. 当然PHP的字符串函数也有很多.我们最常使用的两个系列的字符串: 1.单字节字符串处理函数 2.多字节字符串处理函数 3.字符串编码转换函 ...

  10. Python—字符串常用函数

    Python-字符串常用字符串 字符串是一种表示文本的数据类型,使用单引号和双引号及三引号表示 访问字符串中的值字符串的每个字符都对应一个下标,下标编号是从0开始 转义字符字符串的格式化输出切片常用函 ...

随机推荐

  1. [杂]SQL Server 之命名管道连接

    命名管道是通过进程间通信(IPC)机制实现通信.具体来说,命名管道建立在服务器的IPC$共享基础上,通过IPC$共享来进行通信. SQL Server命名管道 SQL Server 首先在服务器上创建 ...

  2. _EPROCESS结构简单了解!

    _EPROCESS结构简单了解! lkd> dt _EPROCESSnt!_EPROCESS   +0x000 Pcb              : _KPROCESS   +0x06c Pro ...

  3. OD 内存映射 属主找不到当前程序名解决办法 和 跟随ClassProc 反汇编窗口空白解决办法

    OD 内存映射 属主找不到当前程序名解决办法 取消 StrongOD 选项里  高级枚举模块选项就OK了  重启OD 跟随ClassProc  反汇编窗口空白解决办法 StrongOD.dll 是有问 ...

  4. LightOJ1157 LCS Revisited(DP)

    题目求两个字符串s1,s2不同的LCS个数. 经典的求LCS的DP是这样的: LCS[i][j]表示s1[0...i]和s2[0...j]的LCS LCS[i][j]从LCS[i-1][j-1]+1( ...

  5. BZOJ4013 : [HNOI2015]实验比较

    首先用并查集将等号缩点,然后拓扑排序判断有没有环,有环则无解,否则通过增加超级源点$0$,可以得到一棵树. 设$f[x][y]$表示$x$子树里有$y$种不同的数字的方案数,由底向上DP. 对于当前点 ...

  6. BZOJ2773 : ispiti

    首先询问i相当于询问a[j]>=a[i],b[j]>=b[i]的j 如果b[j]==b[i],那么a[j]>a[i],这种情况先用set处理掉 如果b[j]>b[i],那么a[ ...

  7. 十个JavaScript中易犯的小错误,你中了几枪?

    序言 在今天,JavaScript已经成为了网页编辑的核心.尤其是过去的几年,互联网见证了在SPA开发.图形处理.交互等方面大量JS库的出现. 如果初次打交道,很多人会觉得js很简单.确实,对于很多有 ...

  8. 【BZOJ】2002: [Hnoi2010]Bounce 弹飞绵羊(lct)

    http://www.lydsy.com/JudgeOnline/problem.php?id=2002 (BZOJ挂了,还没在BZOJ测,先是在wikioi测过了,,) 囧.在军训时立志要学lct! ...

  9. USACO 5.4 Telecowmunication(最大流+枚举)

    面对最小割之类的题目,完全木想法... 枚举+最大流..复杂度很大了...居然很快的就过了.. /* ID: cuizhe LANG: C++ TASK: telecow */ #include &l ...

  10. php的具体配置学习笔记

    1.将php配置为apache的一个模块,使用loadmodule指令完成. 2.写下面的语句,此外需强调的是,每次配置都需要重新启动apache 3.php文件,要指定将其php模块来处理 4.PH ...