当前位置:网站首页>面试官:说几个PHP常用函数,幸好我面试之前看到了这篇文章
面试官:说几个PHP常用函数,幸好我面试之前看到了这篇文章
2022-04-23 09:39:00 【花少尊者】
序言:PHP 是一种通用开源脚本语言,无论是开发过程中还是面试过程中都会遇到各种函数,今天让我们一块把常用的函数整理一下吧。

字符串(string)函数
strlen:获取字符串长度,字节长度substr_count: 计算子串在字符串中出现的次数substr:字符串截取,获取字符串(按照字节进行截取)strchr:与substr相似,从指定位置截取一直到最后strrchr(获取文件后缀名):与strchr一样,只是从右边开始查找字符strtolower:所有的字符都小写(针对英文字母)strtoupper:所有的字符都大写strrev:字符串反转(只能反转英文:英文存储只有一个字节),按照字节进行反转strpos:从字符串中找对应字符出现的位置(数字下标),从最左边开始找strrpos:与strpos一样,只是从字符串的右边开始找trim:去掉函数两边的字符,默认是空格str_split 函数把字符串分割到数组中。chunk_split: 把字符串分割为一连串更小的部分str_repeat:把字符串重复指定的次数str_replace:替换字符串中的一些字符(大小写敏感)ucfirst :把字符串中的首字符转换为大写日期(date)函数
time:返回当前时间的 Unix 时间戳date:格式化本地日期和时间strtotime:将任何英文文本的日期或时间描述解析为 Unix 时间戳microtime:返回当前 Unix 时间戳的微秒数数字(math)函数
abs:绝对值floor:向下取整ceil:向上取整round:四舍五入rand:取得一个指定范围内的随机整数mt_rand:取得一个指定范围内的随机整数(效率更高)min:返回一个数组中的最小值,或者几个指定值中的最小值max:返回一个数组中的最大值,或者几个指定值中的最大值数组(array)函数
count:返回数组中元素的数目key:从关联数组中取得键名current:获取的当前指针指向元素的数值next:获取下一个元素的值,并且将指针下移prev:获取上一个元素的值,并且将指针上移end :将指针移到数组的最后一个元素,并返回最终指针位置的值reset:将指针移到数组的第一个元素,返回最终指针位置的值array_keys:获取一个数组的所有键名,返回一个索引数组array_values:获取一个数组的所有值,返回一个索引数组explode:把字符串打散为数组implode:返回一个由数组元素组合成的字符串join: implode() 的别名array_merge:把一个或多个数组合并为一个数组array_reverse : 返回反转后的数组array_flip : 交换数组中的键和值array_shift:从数组的前面弹出元素,得到元素的值array_pop:从数组的后面弹出元素,获得元素的值array_unshift:从数组的前面压入元素,得到当前数组元素的个数array_push:从数组的后面压入元素,得到当前数组元素的个数判断函数
is_bool:判断是否是布尔类型is_float:判断是否是浮点型is_integer:判断是否是整型is_object:判断是否是对象is_array:判断是否是数组is_string:判断是否是字符串is_resource:判断是否是资源is_null :检测变量是否为NULLis_numeric:判断数字或者纯数字组成的字符串isset:判断是否被定义总结
以上列举的函数也只是常用的一部分,感兴趣的朋友可以搜索“菜鸟教程”去查看相关的PHP教程。
我是小程序软件开发,每天分享开发过程中遇到的知识点,如果对你有帮助的话,帮忙点个赞再走呗,非常感谢。
往期文章分享:
php一款可以在服务器安装的在线api文档编写工具:showdoc
1分钟搭建FTP服务端,有了这款软件竟然可以如此简单
版权声明
本文为[花少尊者]所创,转载请带上原文链接,感谢
https://www.seoxiehui.cn/article-342882-1.html
边栏推荐
- How to render web pages
- Secrets in buffctf file 1
- Leetcode0587. 安装栅栏(difficult)
- Buuctf [actf2020 freshman competition] include1
- SAP 101K 411k inventory change
- ABAP CDs view with association example
- Random neurons and random depth of dropout Technology
- SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
- Canary publishing using ingress
- nn. Explanation of module class
猜你喜欢

Leetcode question bank 78 Subset (recursive C implementation)

高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?

SAP CR transmission request sequence and dependency check

JS node operation, why learn node operation

Comparison of overloading, rewriting and hiding

ABAP publishes OData service samples from CDs view
![Sql1 [geek challenge 2019]](/img/ad/afca09bc1da003393319af700e90e3.png)
Sql1 [geek challenge 2019]

MySQL of database -- Fundamentals

ABAP 7.4 SQL Window Expression

Using sqlmap injection to obtain the account and password of the website administrator
随机推荐
501. Mode in binary search tree
亚马逊云科技入门资源中心,从0到1轻松上云
MySQL of database -- overview and installation
JS prototype chain
ALV tree (ll LR RL RR) insert delete
SAP RFC_ CVI_ EI_ INBOUND_ Main BP master data creation example (Demo customer only)
JS what is an event? Event three elements and operation elements
NPM installation yarn
STM32 and FreeRTOS stack parsing
NPM reports an error: operation not allowed, MKDIR 'C: \ program files \ node JS \ node_ cache _ cacache’
SAP 101K 411k inventory change
MySQL of database -- basic common query commands
SAP pi / PO function operation status monitoring and inspection
Applet error: cannot read property'currenttarget'of undefined
Leetcode question bank 78 Subset (recursive C implementation)
《數字電子技術基礎》3.1 門電路概述、3.2 半導體二極管門電路
Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
Chinese Remainder Theorem and extended Chinese remainder theorem that can be understood by Aunt Baojie
[SQL Server fast track] view and cursor of database
Employee probation application (Luzhou Laojiao)