PHP对不推荐使用的功能有什么作用? [英] What does PHP do with deprecated functions?

查看:68
本文介绍了PHP对不推荐使用的功能有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取这些错误不建议使用:不建议通过引用分配new的返回值..."

Getting these errors "Deprecated: Assigning the return value of new by reference is deprecated..."

虽然我知道不推荐使用的功能是什么意思,但是我不太清楚PHP对它们有什么作用?还是照常执行它们吗?因此,在此功能的这一点上,PHP是否默默地为变量分配内存位置,还是仍在使用引用指针?

While I know what deprecated function means, but I am not very clear that what PHP does to them? Still execute them as usual? So at this point for this function, does PHP silently assign memory location for the variable or still using reference pointer?

EDIT -感谢您的回答,我问了这个问题,因为我们使用的是adodb_lite,并且库没有更正错误.

EDIT - thanks for the answers, I asked this question because we are using adodb_lite and the library has not corrected error.

推荐答案

已弃用的函数仍然存在,您会收到警告.因此,它们按预期工作.但是,在将来的版本中,它们可能会消失.

Deperecated functions still exist and you get the warning. So they work as expected. However in a future version they might disappear.

其他弃用的语言功能也是如此,您有时会注意到这些功能.这是向具有基于旧PHP版本代码的用户发出更改信号的一种方式.

That's the same for other deprecated language features which you sometimes get notices about. It's a way to signal changes to users which have code based on an older PHP version.

通常,过时的功能会在一段时间后被删除,但是这无法预测需要多长时间.我知道至少有一种情况是以后不推荐使用曾经不推荐使用的功能.但是,我认为这很特殊.

Normally the deprecated features get removed after some time, but it's not predictable how long this takes. I know of at least one case where a once deprecated feature was un-deprecated later on. However, I think that's exceptional.

因此,如果您看到这些警告,请更新代码.通常,PHP文档会提供更多信息,说明为何不推荐使用某些内容以及该怎么做.通常,这是一种改进(例如,在安全性方面),因此,如果您关心代码,则确实应该处理这些警告.

So if you see these warnings, update the code. Most often the PHP documentation has more information why something has been deprecated and what to do. Most often it's an improvement (e.g. in security), so you really should deal with these warnings if you care about the code.

我认为在这种情况下寻找

I think it's noteworthy in this context to look for strict standards notices PHP Manual as well. They are somewhat related because these notices are useful hints for changes in the language as well.

在开发过程中启用 E_STRICT 有一些好处. STRICT消息将帮助您使用建议的最新最好的编码方法,例如警告您使用不推荐使用的函数.

Enabling E_STRICT during development has some benefits. STRICT messages will help you to use the latest and greatest suggested method of coding, for example warn you about using deprecated functions.

(来自上面的PHP手册链接)

(from the PHP Manual link above)

这篇关于PHP对不推荐使用的功能有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆