当前位置:网站首页>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 .
边栏推荐
- Return to blowing marshland -- travel notes of zhailidong, founder of duanzhitang
- haas506 2.0开发教程 - 阿里云ota - pac 固件升级(仅支持2.2以上版本)
- Is it safe to open a stock account by mobile phone? My home is relatively remote. Is there a better way to open an account?
- Typhoon is coming! How to prevent typhoons on construction sites!
- Which is the best online collaboration product? Microsoft loop, notion, flowus
- hdu2377Bus Pass(构建更复杂的图+spfa)
- 解析创客教育的知识迁移和分享精神
- Norgen AAV extractant box instructions (including features)
- 当Steam教育进入个性化信息技术课程
- 显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??
猜你喜欢

从架构上详解技术(SLB,Redis,Mysql,Kafka,Clickhouse)的各类热点问题

CADD course learning (7) -- Simulation of target and small molecule interaction (semi flexible docking autodock)

phpstudy小皮的mysql点击启动后迅速闪退,已解决

示波器探头对信号源阻抗的影响

Abnova CRISPR spcas9 polyclonal antibody protocol

Phpstudy Xiaopi's MySQL Click to start and quickly flash back. It has been solved

Duchefa丨S0188盐酸大观霉素五水合物中英文说明书

Graph embedding learning notes

Analyze the knowledge transfer and sharing spirit of maker Education

XML建模
随机推荐
leetcode:1139. 最大的以 1 为边界的正方形
模式-“里氏替换原则”
获取前一天的js(时间戳转换)
Research and development efficiency improvement practice of large insurance groups with 10000 + code base and 3000 + R & D personnel
Material design component - use bottomsheet to show extended content (II)
Open source SPL eliminates tens of thousands of database intermediate tables
Monorepo management methodology and dependency security
Duchefa d5124 md5a medium Chinese and English instructions
Abnova maxpab mouse derived polyclonal antibody solution
AITM 2-0003 水平燃烧试验
PVC 塑料片BS 476-6 火焰传播性能测定
ts 之 属性的修饰符public、private、protect
ODPs next map / reduce preparation
XML建模
如何让化工企业的ERP库存账目更准确
研学旅游实践教育的开展助力文旅产业发展
字典树简单入门题(居然是蓝题?)
Abnova丨E (DIII) (WNV) 重组蛋白 中英文说明书
Écrire une interface basée sur flask
ts 之 类的简介、构造函数和它的this、继承、抽象类、接口