本文共 1395 字,大约阅读时间需要 4 分钟。
print addslahes ('She said, "Great!"');#output#She said, \"Great!\
echo "hello world"#output#hello world
#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
print htmlentities('An example');# output# <br>An example
print htmlspecialchars('Is "this" true? 3 > 2', ENT_NOQUOTES);# output# Is "this" true? 3 > 2
print md5('1');# Result:# c4ca4238a0b923820dcc509a6f75849b
number_format (number, [number_of_decimals], [decimal_character], [thousand_separator_character])
print number_format(5432.105, 3, ',', '.');# Result:# 5.432,105
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
print strlen('strlen function');#output#15
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 ('string', position_start, substr_length)
print substr('PHP substr is a substring function', 5, 3); #output 'ubs'
转载地址:http://odenx.baihongyu.com/