当前位置:网站首页>Introduction notes to PHP zero Foundation (11): String
Introduction notes to PHP zero Foundation (11): String
2022-04-21 12:22:00 【Peng Shiyu psy】
character string String
String type
- Single quote string
- Double quote string
- nowdoc character string
- heredoc character string
Example
String escape
The system will deal with : The backslash + Letter
for example :
PHP Escape characters commonly used in
The difference between single quotation mark and double quotation mark
1、 You can identify... In single quotation marks \', And you can't recognize it in double quotation marks \'
2、 Variable not recognized in single quotation marks , And double quotation marks can identify $, Parse variables
- Variables in this province need to be distinguished from the following contents , Ensure variable independence
- Use variable identifiers to distinguish , Add a set of braces
{}
Rules for structurally defining string variables
- The boundary character corresponding to the structured definition string is conditional
- There cannot be anything after the upper delimiter
- The bottom border character must be the leftmost top grid
- The lower border character can only be followed by the symbol , Can't follow any characters
- Structurally define the interior of a string ( Between boundary symbols ) All the content of is the string itself
String length
Example
Multi byte string extension module mbstring(Multi String)
String correlation function
1、 Conversion function
implode — Converts the value of a one-dimensional array to a string
explode — Use one string to split another string
str_split — Convert string to array
2、 Intercept function
trim — Remove white space at the beginning and end of a string ( Or other characters )
ltrim — Remove the white space at the beginning of the string ( Or other characters )
rtrim — Remove the white space at the end of the string ( Or other characters )
Example
substr — Returns a substring of a string
strstr — return haystack String from needle The string that first appears from the beginning to the end ( Take the file suffix )
3、 toggle case
strtolower — Convert a string to lowercase
strtoupper — Convert a string to uppercase
ucfirst — Convert the first letter of a string to uppercase
Example
4、 Lookup function
strpos — return needle stay haystack First digit position in .
strrpos — Return string haystack in needle The location of the last number .
5、 Substitution function
str_replace — Substring replacement , The string or array is subject All of them search All be replace Results after replacement .
6、 Format function
printf — Output formatted string
sprintf — Returns a formatted string
Format parameters : https://www.php.net/manual/zh/function.sprintf.php
7、 other
str_repeat — Duplicate a string
str_shuffle — Randomly scramble a string
版权声明
本文为[Peng Shiyu psy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211109376098.html
边栏推荐
- Title record of TIANTI competition (II)
- IPEmotion采集J1939协议信号
- 【软件测试系列五】《软件测试申请表》
- Anchor-free新网络:CenterNet携手CornerNet形成了CenterNet++
- 游戏行业实战案例2:玩家等级
- 【数据可视化应用】绘制双变量映射地图(附R语言代码)
- [software test series v] software test application form
- [Software Testing Series III] "test case writing principles and design methods"
- Study notes of deep learning (6)
- Chris LATTNER, father of llvm: the golden age of compilers
猜你喜欢
![[Software Testing Series II] software testing process specification](/img/c1/011480f4dc1dd63935fb29eaf7e088.png)
[Software Testing Series II] software testing process specification

数据库,把另一张表某字段数据添加到另一个表中,同时加入的时候加入自己需要的数据

虚拟货币已然没有市场,为何还能对一些人产生不小的诱惑?

总有一天,阿里系数据库会将Oracle挤出市场

Integration announcement keyfi is now online moonbeam

关于ros版本问题导致MarkerArray的不显示解决
![[dark horse morning post] Tao Hong paid 260 million dividends from Zhangting MLM company in three years; Yiling pharmaceutical replied to Lianhua Qingwen dispute: the case has been reported; Tencent v](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Tao Hong paid 260 million dividends from Zhangting MLM company in three years; Yiling pharmaceutical replied to Lianhua Qingwen dispute: the case has been reported; Tencent v

【软件测试系列一】《软件测试基础知识》

Redis数据库集群(主从复制、哨兵、Cluster)

Is it difficult to choose binary version control tools? After reading this article, you will find the answer
随机推荐
WordPress Amministrazione Aperta 3.7.3 任意文件读取
虚拟货币已然没有市场,为何还能对一些人产生不小的诱惑?
Study notes of "deep learning" (V)
Kubernetes 服务发现 监控APIServer
【软件测试系列十】《压力测试方案》
JD cloud distributed database stardb successfully completed multi-party localization adaptation certification
Extract name from given string (string, list, re "zero width assertion")
骚包的中文字符提取操作(字符串,不用 re ,用 in )
Machine learning-sklearn-13 (regression family - lower - nonlinear problem: polynomial regression (a new characteristic matrix is formed after polynomial transformation))
S parameter introduction
[software test series v] software test application form
Live broadcast of changes in the Jianghu: Li Jiaqi is trapped in a luxury house, Luo Yonghao fades out, and Weiya Sydney helps broadcast it
Is it difficult to choose binary version control tools? After reading this article, you will find the answer
分享几款我在高频使用的 Chrome 浏览器插件,每一个都好用到飞起
jsapi 支付缺少appid
How to achieve centralized management, flexible and efficient CI / CD online seminar highlights sharing
[Software Testing Series III] "test case writing principles and design methods"
One minute teaches you to use yolov5 to train your dataset and test it
Reverse crawler 30 verification code of a fourth generation slider
伯克利、三星|一个快速的训练后变换器修剪框架