当前位置:网站首页>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 .
边栏推荐
- Abnova丨 CD81单克隆抗体相关参数和应用
- PVC 塑料片BS 476-6 火焰传播性能测定
- MySQL ifnull usage function
- PHP deserialization +md5 collision
- EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
- 当Steam教育进入个性化信息技术课程
- ProSci LAG3抗体的化学性质和应用说明
- Abnova fluorescent dye 620-m streptavidin scheme
- Chemical properties and application instructions of prosci Lag3 antibody
- Popular science | does poor English affect the NPDP exam?
猜你喜欢

显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??

浅聊我和一些编程语言的缘分

ClickHouse 复制粘贴多行sql语句报错

培养机器人教育创造力的前沿科技

中国的软件公司为什么做不出产品?00后抛弃互联网;B站开源的高性能API网关组件|码农周刊VIP会员专属邮件周报 Vol.097

Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Nanjing

Use of thread pool

Norgen AAV提取剂盒说明书(含特色)

基于flask写一个接口
mysql全面解析json/数组
随机推荐
获取前一天的js(时间戳转换)
shell编程100例
Go file path operation
教你自己训练的pytorch模型转caffe(一)
ODPS 下一个map / reduce 准备
phpstudy小皮的mysql点击启动后迅速闪退,已解决
基于flask写一个接口
Abnova丨血液总核酸纯化试剂盒预装相关说明书
序列联配Sequence Alignment
教你自己训练的pytorch模型转caffe(二)
Monorepo管理方法论和依赖安全
最长摆动序列[贪心练习]
leetcode:1755. 最接近目标值的子序列和
SQL series (basic) - Chapter 2 limiting and sorting data
教你自己训练的pytorch模型转caffe(三)
PVC 塑料片BS 476-6 火焰传播性能测定
Abnova 环孢素A单克隆抗体,及其研究工具
重上吹麻滩——段芝堂创始人翟立冬游记
Analyze the knowledge transfer and sharing spirit of maker Education
MySQL InnoDB架构原理