当前位置:网站首页>Traps in the explode function in PHP
Traps in the explode function in PHP
2022-07-05 20:56:00 【Fengshen Magic Dragon】
In general , All are carried out when the parameter is not empty explode operation , for example
$a = "a,b,c";
$b = explode(',',$a);
The result will be returned
array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" }
But what if the passed in parameter is empty ?
$a = '';
$b = explode(',',$a);
What results will be returned at this time , Will you think that return
array(0) { }
It's not , It will be returned
array(1) { [0]=> string(0) "" }
If you treat it as a short array , Then all the subsequent logic will go wrong , Because it is not an empty array ,empty It does not return true, So in use explode Be sure to pay attention to the value of the second parameter , It's best to make a non empty judgment first , Later explode operation .
边栏推荐
- 中国管理科学研究院凝聚行业专家,傅强荣获智库专家“十佳青年”称号
- Material Design组件 - 使用BottomSheet展现扩展内容(二)
- Simple getting started example of Web Service
- Chemical properties and application instructions of prosci Lag3 antibody
- 2.<tag-哈希表, 字符串>补充: 剑指 Offer 50. 第一个只出现一次的字符 dbc
- Where is a good stock account? Is online account manager safe to open an account
- Maker education infiltrating the transformation of maker spirit and culture
- Analyze the knowledge transfer and sharing spirit of maker Education
- Prior knowledge of machine learning in probability theory (Part 1)
- 清除app data以及获取图标
猜你喜欢
Chemical properties and application instructions of prosci Lag3 antibody
Duchefa丨P1001植物琼脂中英文说明书
PHP deserialization +md5 collision
Duchefa d5124 md5a medium Chinese and English instructions
Analysis of steam education mode under the integration of five Education
ProSci LAG-3 重组蛋白说明书
基于AVFoundation实现视频录制的两种方式
ProSci LAG3抗体的化学性质和应用说明
CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)
Duchefa low melting point agarose PPC Chinese and English instructions
随机推荐
Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Nanjing
PVC 塑料片BS 476-6 火焰传播性能测定
Abbkine BCA法 蛋白质定量试剂盒说明书
Implementation of redis unique ID generator
Mathematical analysis_ Notes_ Chapter 9: curve integral and surface integral
PHP deserialization +md5 collision
Abnova丨 MaxPab 小鼠源多克隆抗体解决方案
Abnova丨培养细胞总 RNA 纯化试剂盒中英文说明书
产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)
教你自己训练的pytorch模型转caffe(二)
最长摆动序列[贪心练习]
Abnova DNA marker high quality control test program
Abnova 环孢素A单克隆抗体,及其研究工具
haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)
ProSci LAG3抗体的化学性质和应用说明
教你自己训练的pytorch模型转caffe(一)
How to renew NPDP? Here comes the operation guide!
研学旅游实践教育的开展助力文旅产业发展
When steam education enters personalized information technology courses