当前位置:网站首页>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 .
边栏推荐
- 教你自己训练的pytorch模型转caffe(一)
- 最长摆动序列[贪心练习]
- Promouvoir le développement de l'industrie culturelle et touristique par la recherche, l'apprentissage et l'enseignement pratique du tourisme
- Duchefa d5124 md5a medium Chinese and English instructions
- 科普|英语不好对NPDP考试有影响吗 ?
- How to renew NPDP? Here comes the operation guide!
- ViewRootImpl和WindowManagerService笔记
- AITM2-0002 12s或60s垂直燃烧试验
- Duchefa s0188 Chinese and English instructions of spectinomycin hydrochloride pentahydrate
- Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
猜你喜欢
当Steam教育进入个性化信息技术课程
从架构上详解技术(SLB,Redis,Mysql,Kafka,Clickhouse)的各类热点问题
Abnova丨CRISPR SpCas9 多克隆抗体方案
2. < tag hash table, string> supplement: Sword finger offer 50 The first character DBC that appears only once
显示屏DIN 4102-1 Class B1防火测试要求
Promouvoir le développement de l'industrie culturelle et touristique par la recherche, l'apprentissage et l'enseignement pratique du tourisme
中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097
Abnova丨 MaxPab 小鼠源多克隆抗体解决方案
ProSci LAG3抗体的化学性质和应用说明
Duchefa丨P1001植物琼脂中英文说明书
随机推荐
Abnova cyclosporin a monoclonal antibody and its research tools
Abnova丨DNA 标记高质量控制测试方案
ClickHouse 复制粘贴多行sql语句报错
Prior knowledge of machine learning in probability theory (Part 1)
CareerCup它1.8 串移包括问题
Phpstudy Xiaopi's MySQL Click to start and quickly flash back. It has been solved
教你自己训练的pytorch模型转caffe(二)
10000+ 代码库、3000+ 研发人员大型保险集团的研发效能提升实践
Écrire une interface basée sur flask
国外LEAD美国简称对照表
Duchefa MS medium contains vitamin instructions
Abbkine trakine F-actin Staining Kit (green fluorescence) scheme
MySQL InnoDB架构原理
Open source SPL eliminates tens of thousands of database intermediate tables
Abnova丨CRISPR SpCas9 多克隆抗体方案
Duchefa丨低熔点琼脂糖 PPC中英文说明书
Abbkine BCA法 蛋白质定量试剂盒说明书
Monorepo管理方法论和依赖安全
Abnova丨 CD81单克隆抗体相关参数和应用
ViewRootImpl和WindowManagerService笔记