search
PHP5 common functionsDec 01, 2016 am 11:51 AM
xml

PHP has been updated to many versions, and the one that is used more recently is PHP5. Below we have summarized the common functions of PHP5 for you so that you can check them when actually writing code in the future.

pathinfo returns file path information, including the following array units: dirname, basename and extension.

func_num_args(), func_get_arg(), func_get_args()
glob— Find file paths matching the pattern
gzcompress() and gzuncompress() functions:
json_encode() and json_decode()
serialize() and unserialize() in My personal experience mainly deals with array transfer and array storage operations.

is_dir
mb_detect_encoding Automatically obtains the string encoding function
usleep() function delays code execution for several microseconds.
unpack() function unpacks data from a binary string. The
uniqid () function generates a unique ID based on the current time in microseconds.
time_sleep_until() function delays code execution until the specified time.
The time_nanosleep() function, a commonly used function in PHP5, delays code execution for a number of seconds and nanoseconds.
sleep() function delays code execution for a few seconds.
show_source() function performs syntax highlighting on files. The
strip_whitespace() function returns the source code file with PHP comments and whitespace characters removed. The
pack() function loads data into a binary string.
ignore_user_abort() function sets whether disconnecting from the client will terminate the execution of the script.
highlight_string() function performs syntax highlighting on strings.
highlight_file() function performs syntax highlighting on files.
The get_browser() function, a commonly used function in PHP5, returns the performance of the user's browser. The
eval() function evaluates strings according to PHP code.
defined() function checks whether a constant exists.
define() function defines a constant.
constant() function returns the value of a constant.
The connection_status() function, a commonly used function in PHP5, returns the current connection status.
connection_aborted() function checks whether the client is disconnected.
utf8_encode() function encodes ISO-8859-1 string to UTF-8.
utf8_decode() function decodes UTF-8 string to ISO-8859-1.
The wordwrap () function wraps the string according to the specified length.
nl2br
fgetcsv

vsprintf() function writes the formatted string into a variable.
vprintf() function outputs a formatted string.
vfprintf() function writes the formatted string to the specified output stream.
The ucwords () function, a commonly used function in PHP5, converts the first character of each word in the string to uppercase.
ucfirst() function converts the first character in a string to uppercase.
trim() function removes whitespace characters and other predefined characters from both ends of a string.
substr_replace() function replaces part of a string with another string.
substr_count() function counts the number of times a substring appears in a string.
substr_compare() function compares two strings from a specified starting length.
substr() function returns a part of a string.
strtr() function converts specific characters in a string.
The strtok() function, a commonly used function in PHP5, splits a string into smaller strings.
strstr() function searches for the first occurrence of a string within another string.
strspn() function returns the number of specific characters contained in a string.
strrpos() function finds the last occurrence of a string within another string.
strripos() function finds the last occurrence of a string within another string.
strrev() function reverses a string.
strrchr() function finds the last occurrence of a string in another string and returns all characters from that position to the end of the string.
strpos() function returns the position of the first occurrence of a string in another string.
The strpbrk() function, a commonly used function in PHP5, searches for any one of the specified characters in a string.
strncmp() function compares two strings.
strncasecmp() function compares two strings.
strnatcmp() function uses a "natural" algorithm to compare two strings.
strnatcasecmp() function uses a "natural" algorithm to compare two strings.
strlen() function returns the length of the string.
stristr() function finds the first occurrence of a string within another string.
stripos() function returns the position of the first occurrence of a string in another string. ​
The stripslashes () function removes the backslashes added by the addslashes() function.
stripcslashes() function removes backslashes added by addcslashes() function.
strip_tags() function strips HTML, XML and PHP tags.
strcspn() function returns the number of characters searched in a string before any specified character is found.
The strcoll() function, a commonly used function in PHP5, compares two strings.
strcmp () function compares two strings.
strchr() function searches for the first occurrence of a string within another string.
strcasecmp() function compares two strings.
str_word_count() function counts the number of words in a string.
str_split() function splits a string into an array.
str_shuffle () function randomly shuffles all characters in a string.
str_rot13() function performs ROT13 encoding on a string.
str_replace() function uses a string to replace other characters in a string.
str_repeat() function repeats a string a specified number of times.
str_pad() function pads the string to the specified length.
str_ireplace() function uses a string to replace other characters in a string.
PHP5 commonly used function sscanf() function parses input from a string according to the specified format.
sprintf () function writes the formatted string into a variable.
soundex() function calculates the soundex key of a string.
similar_text() function counts the number of matching characters in two strings. The
sha1_file() function calculates the SHA-1 hash of a file. The
sha1() function computes the SHA-1 hash of a string.
setlocale() function sets regional information (regional information).
PHP5 commonly used functions rtrim() P rtrim() function

basename — Returns the file name part of the path

dirname — Returns the directory part of the path

array_filter — Filters the units in the array with a callback function
array_flip — Exchange Keys and values ​​in the array

array_count_values ​​determines the number of times a character appears in the string

array_uintersect — Calculate the intersection of arrays, use callback functions to compare data
array_unique — Remove duplicate values ​​in the array array_flip(array_flip())

arsort — Sort the array in reverse order and maintain the index relationship

array_sum — Calculate the sum of all values ​​in the array

array_search — Search the array for a given value, returning the corresponding key name if successful

in_array — Check the array Whether there is a certain value

array_push — push one or more units to the end of the array (push)

array_unshift() function inserts one or more elements at the beginning of the array

array_values ​​returns all the values ​​in the input array and Create a numerical index for it. ////Use the array_values ​​function to reindex

count_chars Returns the information of the characters used in the string

array_keys Returns all the key names in the array

array_slice Takes a segment from the array

key() Returns the current unit in the array Key name .

get_class_methods — Returns an array consisting of the method names of the class
get_class_vars — Returns an array consisting of the default attributes of the class
get_class — Returns the class name of the object
get_declared_classes — Returns an array consisting of the names of defined classes
get_declared_interfaces — Returns An array containing all declared interfaces
get_object_vars — Returns an associative array composed of object attributes
get_parent_class — Returns the parent class name of the object or class
interface_exists — Checks whether the interface has been defined
is_a — If the object belongs to this class or class If it is the parent class of this object, return TRUE
is_subclass_of — If this object is a subclass of this class, return TRUE
method_exists — Check whether the method of the class exists
property_exists — Check whether the object or class has this property

parse_str (url, arr) is to convert a url? The following parameters into an array
parse_url (string url) is to parse a complete url into an array
http_build_query is to convert an array into a url? The following parameter string will be automatically Perform urlencode processing
call_user_func_array

ctype_alnum -- Check whether it only contains [A-Za-z0-9]
ctype_alpha -- Check whether it only contains [A-Za-z]
ctype_cntrl -- Check whether it only contains classes It is a character control character such as " "
ctype_digit -- When checking, it is a string containing only numeric characters (0-9). Negative numbers and decimals will not be detected.

filter_var($email, FILTER_VALIDATE_EMAIL)
ctype_graph --Check whether It is a string that only contains characters that can be printed (except spaces)
ctype_lower -- Checks whether all characters are English letters and all are lowercase
ctype_print -- Checks whether it only contains characters that can be printed The string
ctype_punct -- Check whether it only contains printable characters that are not numbers/characters/spaces
ctype_space -- Check whether it only contains characters and spaces such as " "
ctype_upper -- Check whether all The characters are all English letters, and they are all uppercase
ctype_xdigit -- Check whether it is a hexadecimal string, which can only include "0123456789abcdef"


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
XML外部实体注入漏洞的示例分析XML外部实体注入漏洞的示例分析May 11, 2023 pm 04:55 PM

一、XML外部实体注入XML外部实体注入漏洞也就是我们常说的XXE漏洞。XML作为一种使用较为广泛的数据传输格式,很多应用程序都包含有处理xml数据的代码,默认情况下,许多过时的或配置不当的XML处理器都会对外部实体进行引用。如果攻击者可以上传XML文档或者在XML文档中添加恶意内容,通过易受攻击的代码、依赖项或集成,就能够攻击包含缺陷的XML处理器。XXE漏洞的出现和开发语言无关,只要是应用程序中对xml数据做了解析,而这些数据又受用户控制,那么应用程序都可能受到XXE攻击。本篇文章以java

如何用PHP和XML实现网站的分页和导航如何用PHP和XML实现网站的分页和导航Jul 28, 2023 pm 12:31 PM

如何用PHP和XML实现网站的分页和导航导言:在开发一个网站时,分页和导航功能是很常见的需求。本文将介绍如何使用PHP和XML来实现网站的分页和导航功能。我们会先讨论分页的实现,然后再介绍导航的实现。一、分页的实现准备工作在开始实现分页之前,需要准备一个XML文件,用来存储网站的内容。XML文件的结构如下:<articles><art

php如何将xml转为json格式?3种方法分享php如何将xml转为json格式?3种方法分享Mar 22, 2023 am 10:38 AM

当我们处理数据时经常会遇到将XML格式转换为JSON格式的需求。PHP有许多内置函数可以帮助我们执行这个操作。在本文中,我们将讨论将XML格式转换为JSON格式的不同方法。

Python中怎么对XML文件的编码进行转换Python中怎么对XML文件的编码进行转换May 21, 2023 pm 12:22 PM

1.在Python中XML文件的编码问题1.Python使用的xml.etree.ElementTree库只支持解析和生成标准的UTF-8格式的编码2.常见GBK或GB2312等中文编码的XML文件,用以在老旧系统中保证XML对中文字符的记录能力3.XML文件开头有标识头,标识头指定了程序处理XML时应该使用的编码4.要修改编码,不仅要修改文件整体的编码,还要将标识头中encoding部分的值修改2.处理PythonXML文件的思路1.读取&解码:使用二进制模式读取XML文件,将文件变为

Python中xmltodict对xml的操作方式是什么Python中xmltodict对xml的操作方式是什么May 04, 2023 pm 06:04 PM

Pythonxmltodict对xml的操作xmltodict是另一个简易的库,它致力于将XML变得像JSON.下面是一个简单的示例XML文件:elementsmoreelementselementaswell这是第三方包,在处理前先用pip来安装pipinstallxmltodict可以像下面这样访问里面的元素,属性及值:importxmltodictwithopen("test.xml")asfd:#将XML文件装载到dict里面doc=xmltodict.parse(f

使用nmap-converter将nmap扫描结果XML转化为XLS实战的示例分析使用nmap-converter将nmap扫描结果XML转化为XLS实战的示例分析May 17, 2023 pm 01:04 PM

使用nmap-converter将nmap扫描结果XML转化为XLS实战1、前言作为网络安全从业人员,有时候需要使用端口扫描利器nmap进行大批量端口扫描,但Nmap的输出结果为.nmap、.xml和.gnmap三种格式,还有夹杂很多不需要的信息,处理起来十分不方便,而将输出结果转换为Excel表格,方面处理后期输出。因此,有技术大牛分享了将nmap报告转换为XLS的Python脚本。2、nmap-converter1)项目地址:https://github.com/mrschyte/nmap-

xml中node和element的区别是什么xml中node和element的区别是什么Apr 19, 2022 pm 06:06 PM

xml中node和element的区别是:Element是元素,是一个小范围的定义,是数据的组成部分之一,必须是包含完整信息的结点才是元素;而Node是节点,是相对于TREE数据结构而言的,一个结点不一定是一个元素,一个元素一定是一个结点。

深度使用Scrapy:如何爬取HTML、XML、JSON数据?深度使用Scrapy:如何爬取HTML、XML、JSON数据?Jun 22, 2023 pm 05:58 PM

Scrapy是一款强大的Python爬虫框架,可以帮助我们快速、灵活地获取互联网上的数据。在实际爬取过程中,我们会经常遇到HTML、XML、JSON等各种数据格式。在这篇文章中,我们将介绍如何使用Scrapy分别爬取这三种数据格式的方法。一、爬取HTML数据创建Scrapy项目首先,我们需要创建一个Scrapy项目。打开命令行,输入以下命令:scrapys

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),