php常用函数

这些函数提供参考,想了解具体的使用方式可进行百度

1、html_entity_decode()函数
含义:把 HTML 实体转换为字符,html_entity_decode() 函数是 htmlentities() 函数的反函数
语法:html_entity_decode(string,flags,character-set)
2、str_replace()
含义:函数以其他字符替换字符串中的一些字符(区分大小写)
用法:把字符串 "Hello world!" 中的字符 "world" 替换为 "Shanghai":
<?php
     echo str_replace("world","Shanghai","Hello world!");
   ?>
语法:str_replace(find,replace,string,count)
3、array_unique()函数
含义:移除数组中的重复的值,并返回结果数组
语法:array_unique(array)
4、sprintf()函数
含义:把格式化的字符串写入变量中。
用法:sprintf('%.2f', 数字); 可将钱的格式转成0.00,有多种用法及含义




原文地址:https://www.cnblogs.com/jiaoda/p/8400343.html