php Function split() is deprecated 的解决办法
原文地址: http://www.cnblogs.com/mfryf/archive/2012/05/31/2527307.html
php升级为5.3后,程序会报 Function split() is deprecated 的错误。
这是因为种种原因(主要是关于正则的原因,具体见后),split这个函数在新版本不支持了。
在php中,再使用deprecated的函数会报错,必须改掉。(java里deprecated的函数只是给警告,还可以继续用)
改为什么呢? 看第一个参数,如果第一个参数不是正则表达式,split改为 explode;如果是正则表达式,split改为preg_split。
explode会比以前快很多,因为以前要考虑正则,explode不考虑正则。
————-
PHP 5.3.0 之後的 regex, 希望使用 PCRE 的規格, POSIX Regex 都不建議使用了(統一 Regex, 避免規格太多?).
所以下述是不建議使用的 Function (POSIX), 與建議替換成的 Function (PCRE) 列表, 詳可見: PHP:
Differences from POSIX regex
* POSIX → PCRE
* ereg_replace() → preg_replace()
* ereg() → preg_match()
* eregi_replace() → preg_replace()
* eregi() → preg_match()
* split() → preg_split()
* spliti() → preg_split()
* sql_regcase() → No equivalent
* 需要 regex 的 split, 可用 preg_split() 代替
* 不需要 regex, 只要要快速分割固定的字串, 可用 explode() 代替. (速度會比需要 regex 的快很多)
php Function split() is deprecated 的解决办法的更多相关文章
- PHP:错误 Deprecated: Function split() is deprecated in ... 解决办法
PHP:错误 Deprecated: Function split() is deprecated in ... 解决办法 PHP5.3 split() 不建议使用的原因:PHP 5.3.0 之后的r ...
- Deprecated: Function split() is deprecated in ... 解决办法
本地测试的程序上传到服务器出现很多错误,Deprecated: Function split() is deprecated 查了原因是因为PHP的版本不同所导致的,本身程序开发的时候用的是PHP5 ...
- PHP Deprecated: Function split() is deprecated in /var/www/html/cacti/cmd.php on line 61
[root@localhost cacti]# php cmd.php PHP Deprecated: Function split() is deprecated in /var/www/html/ ...
- php Function ereg() is deprecated的解决方法
PHP 5.3 ereg() 无法正常使用,提示“Function ereg() is deprecated Error”.问题根源是php中有两种正则表示方法,一个是posix,一个是perl,ph ...
- Android系统编译错误Note: Some input files use or override a deprecated API. 解决办法【转】
本文转载自:http://blog.csdn.net/lilidejing/article/details/46564491 进入系统framework层修改了下MediaPlayer.java的源码 ...
- 显示Deprecated: Assigning the return value of new by reference is deprecated in解决办法
很多朋友的php程序当php的版本升级到5.3以后,会出现”Deprecated: Assigning the return value of new by reference is deprecat ...
- 【转】Deprecated: Function ereg_replace() is deprecated的解决方法
这个问题是因为你用的php版本过高. 在php5.3中,正则函数ereg_replace已经废弃,而dedecms还继续用.有两个方案可以解决以上问题: 1.把php版本换到v5.3下. 2.继续使用 ...
- php 版本升高后 会出现 之Deprecated: Function ereg_replace() is deprecated的解决方法
这个问题是因为php版本过高. 在php5.3中,正则函数ereg_replace已经废弃,而dedecms还继续用.有两个方案可以解决以上问题: 1.把php版本换到v5.3下. 2.继续使用v5. ...
- Function mysql_db_query() is deprecated 错误解决
方法一:@ 在任何错误语句之前加上@符号,即可屏蔽! 方法二:error_reporting 在PHP文件第一行加上:error_reporting(0); 即可屏蔽! 方法三:display_err ...
随机推荐
- **PHP foreach 如何判断为数组最后一个最高效?
http://www.zhihu.com/question/20158667 其他方法: $list = array('a', 'b', 'c'); foreach($list as $k=>$ ...
- Pg168-1
1.Pg168-1 package org.hanqi.pn0120; public class Computer { private double neicundx=10; public doubl ...
- Android Studio 升级为3.1 踩到的坑
原文:https://blog.csdn.net/xiariluoxue/article/details/80050700 AndroidStudio.gradle.buildToolsVersion ...
- TypeScript学习笔记(四) - 类和接口
本篇将介绍TypeScript里的类和接口. 与其他强类型语言类似,TypeScript遵循ECMAScript 2015标准,支持class类型,同时也增加支持interface类型. 一.类(cl ...
- 《Android源码设计模式》----面向对象六大原则
1.单一职责原则 Single Respoonsibility Principle(SRP) --封装 2.开闭原则 Open Close Principle(OCP)--对扩展开放,对修改封闭 3. ...
- 虚拟机zookeeper和hbase集群搭建
集群zookeeper dataDir=/usr/local/zookeeper/dataDir dataLogDir=/usr/local/zookeeper/dataLogDir # the po ...
- 学习Git操作的好资源
网上资源很多,极大的方便了我们学习新东西. 今天找到了几个简单明了的Git教程,用以备录共享. Learn Git Branching http://pcottle.github.io/learnG ...
- 表单验证插件validate
http://www.runoob.com/jquery/jquery-plugin-validate.html <!DOCTYPE html> <html lang="e ...
- Java设计模式GOF之6大设计原则
Java设计模式GOF之6大设计原则原则 1.开闭原则(Open Close Principle) 一个软件实体如类.模块和函数应该对扩展开放,对修改关闭. 开闭原则是面向对象的可复用设计的第一块基石 ...
- BZOJ 2653: middle 主席树 二分
https://www.lydsy.com/JudgeOnline/problem.php?id=2653 因为是两个方向向外延伸所以不能对编号取前缀和(这里只有前缀和向后传递的性质,不是实际意义的和 ...