


Summary of study notes PHP string processing functions_PHP tutorial
After a long period of development of PHP, many users are familiar with PHP. Here I will share my personal understanding of PHP string processing functions. I hope it will be helpful to everyone. PHP itself is a simple and powerful language.
Summary of PHP string processing functions:
<ol class="dp-xml"> <li class="alt"><span><span>addcslashes —— 为字符串里面的部分字符添加反斜线转义字符 </span></span></li> <li class=""><span>addslashes —— 用指定的方式对字符串里面的字符进行转义 </span></li> <li class="alt"><span>bin2hex —— 将二进制数据转换成十六进制表示 </span></li> <li class=""><span>chr —— 返回一个字符的ASCII码 </span></li> <li class="alt"><span>chunk_split —— 按一定的字符长度将字符串分割成小块 </span></li> <li class=""><span>convert_cyr_string —— 将斯拉夫语字符转换为别的字符 </span></li> <li class="alt"><span>convert_uudecode —— 解密一个字符串 </span></li> <li class=""><span>convert_uuencode —— 加密一个字符串 </span></li> <li class="alt"><span>count_chars —— 返回一个字符串里面的字符使用信息 </span></li> <li class=""><span>crc32 —— 计算一个字符串的crc32多项式 </span></li> <li class="alt"><span>crypt —— 单向散列加密函数 </span></li> <li class=""><span>explode —— 将一个字符串用分割符转变为一数组形式 </span></li> <li class="alt"><span>fprintf —— 按照要求对数据进行返回,并直接写入文档流 </span></li> <li class=""><span>get_html_translation_table —— 返回可以转换的HTML实体 </span></li> <li class="alt"><span>html_entity_decode —— htmlentities ()函数的反函数,将HTML实体转换为字符 </span></li> <li class=""><span>htmlentities —— 将字符串中一些字符转换为HTML实体 </span></li> <li class="alt"><span>htmlspecialchars_decode —— htmlspecialchars()函数的反函数,将HTML实体转换为字符 </span></li> <li class=""><span>htmlspecialchars —— 将字符串中一些字符转换为HTML实体 </span></li> <li class="alt"><span>implode —— 将数组用特定的分割符转变为字符串 </span></li> <li class=""><span>join —— 将数组转变为字符串,implode()函数的别名 </span></li> <li class="alt"><span>levenshtein —— 计算两个词的差别大小 </span></li> <li class=""><span>localeconv —— 获取数字相关的格式定义 </span></li> <li class="alt"><span>ltrim —— 去除字符串左侧的空白或者指定的字符 </span></li> <li class=""><span>md5_file —— 将一个文件进行MD5算法加密 </span></li> <li class="alt"><span>md5 —— 将一个字符串进行MD5算法加密 </span></li> <li class=""><span>metaphone —— 判断一个字符串的发音规则 </span></li> <li class="alt"><span>money_format —— 按照参数对数字进行格式化的输出 </span></li> <li class=""><span>nl_langinfo —— 查询语言和本地信息 </span></li> <li class="alt"><span>nl2br —— 将字符串中的换行符“n”替换成“ </span></li> <li class=""><span>” </span></li> <li class="alt"><span>number_format —— 按照参数对数字进行格式化的输出 </span></li> <li class=""><span>ord —— 将一个ASCII码转换为一个字符 </span></li> <li class="alt"><span>parse_str —— 把一定格式的字符串转变为变量和值 </span></li> <li class=""><span>print —— 用以输出一个单独的值 </span></li> <li class="alt"><span>printf —— 按照要求对数据进行显示 </span></li> <li class=""><span>quoted_printable_decode —— 将一个字符串加密为一个8位的二进制字符串 </span></li> <li class="alt"><span>quotemeta —— 对若干个特定字符进行转义 </span></li> <li class=""><span>rtrim —— 去除字符串右侧的空白或者指定的字符 </span></li> <li class="alt"><span>setlocale —— 设置关于数字,日期等等的本地格式 </span></li> <li class=""><span>sha1_file —— 将一个文件进行SHA1算法加密 </span></li> <li class="alt"><span>sha1 —— 将一个字符串进行SHA1算法加密 </span></li> <li class=""><span>similar_text —— 比较两个字符串,返回系统认为的相似字符个数 </span></li> <li class="alt"><span>soundex —— 判断一个字符串的发音规则 </span></li> <li class=""><span>sprintf —— 按照要求对数据进行返回,但是不输出 </span></li> <li class="alt"><span>sscanf —— 可以对字符串进行格式化 </span></li> <li class=""><span>str_ireplace —— 像str_replace()函数一样匹配和替换字符串,但是不区分大小写 </span></li> <li class="alt"><span>str_pad —— 对字符串进行两侧的补白 </span></li> <li class=""><span>str_repeat —— 对字符串进行重复组合 </span></li> <li class="alt"><span>str_replace —— 匹配和替换字符串 </span></li> <li class=""><span>str_rot13 —— 将字符串进行ROT13加密处理 </span></li> <li class="alt"><span>str_shuffle —— 对一个字符串里面的字符进行随机排序 </span></li> <li class=""><span>str_split —— 将一个字符串按照字符间距分割为一个数组 </span></li> <li class="alt"><span>str_word_count —— 获取字符串里面的英文单词信息 </span></li> <li class=""><span>strcasecmp —— 对字符串进行大小比较,不区分大小写 </span></li> <li class="alt"><span>strchr —— 通过比较返回一个字符串的部分strstr()函数的别名 </span></li> <li class=""><span>strcmp —— 对字符串进行大小比较 </span></li> <li class="alt"><span>strcoll – 根据本地设置对字符串进行大小比较 </span></li> <li class=""><span>strcspn —— 返回字符连续非匹配长度的值 </span></li> <li class="alt"><span>strip_tags —— 去除一个字符串里面的HTML和PHP代码 </span></li> <li class=""><span>stripcslashes —— 反转义addcslashes()函数转义处理过的字符串 </span></li> <li class="alt"><span>stripos —— 查找并返回首个匹配项的位置,匹配不区分大小写 </span></li> </ol>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
