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. android 兼容性测试 CTS 测试过程(实践测试验证通过)

    source: http://blog.csdn.net/jianguo_liao19840726/article/details/7222814 写这个博客的时候是为了记忆,建议大家还是看官方的说明 ...

  2. hrbustoj 1161:Leyni(树状数组练习)

    LeyniTime Limit: 3000 MS Memory Limit: 65536 KTotal Submit: 260(59 users) Total Accepted: 80(55 user ...

  3. 《Bluez 》Beta版强势回归!!!

    Bluez .Beta 巅峰塔防 强势回归! Z.XML为您呈现 经过了第二轮迭代,我们骄傲的宣布,Bluez Beta版本,正式发布. 下载地址:-> 第二轮的迭代是辛苦的,但是不同于其他队伍 ...

  4. [整理]android中几种常见的尺寸

    获取屏幕宽高尺寸的三种代码形式 在Android上,目前我知道的获取屏幕尺寸的方法有三种不同的代码形式 方法1.在Activity中最常见的调用方式 WindowManager windowManag ...

  5. Android 命名规范 (提高代码可以读性) 转

    转自:http://blog.csdn.net/vipzjyno1/article/details/23542617 刚接触android的时候,命名都是按照拼音来,所以有的时候想看懂命名的那个控件 ...

  6. loj 1018(状压dp+记忆化搜索)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=25844 思路:首先预处理出点在同一直线上的所有的点集状态(dp[i ...

  7. android 完美退出所有Activity的demo

    项目地址:https://github.com/libill/myapplication 利用android的wheel和参考android完美退出程序做出来的demo,结束掉所有打开的Activit ...

  8. EntityFramework 6.0< Code First > 连接 Mysql数据库

    网上有很多关于用EntityFrame来连接Mysql数据库的教程,可是很多并不靠谱,转载的太多了.找了很久,总算是配置好了,现在分享一下. 一,安装:     1.开发环境: VS2013与EF6 ...

  9. BZOJ1508 : [NOI2003]Game

    a[i][j]:i移动一根变成j是否可能 b[i][j]:i增加一根变成j是否可能 枚举在一个数字中移动的情况以及在两个数字中移动的情况 #include<cstdio> #include ...

  10. 升级到WP8必需知道的13个特性

    http://www.cnblogs.com/sonic1abc/archive/2012/11/28/2792467.html   Windows phone 8 SDK 已经发布一段时间了, 已经 ...