PHP 5.3 向后兼容 PHP 5.2 吗?

发布于 2024-10-11 22:26:15 字数 112 浏览 9 评论 0原文

我开始学习PHP。我想使用 PHP 5.3,因为它是迄今为止的最新版本。我正在开发一个项目,在该项目中我将使用某人给我的 PHP 5.2 脚本。

即使我使用 PHP 5.3,它们也能正常运行吗?

I'm starting to learn PHP. I would like to use PHP 5.3 because it's the newest version so far. I'm working on a project in which I'll use PHP 5.2 scripts that someone gave me.

Are they going to run just fine even though I'm using PHP 5.3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

岁月苍老的讽刺 2024-10-18 22:26:16

PHP.net 提供了从 PHP 5.2.x 升级到 PHP 5.3 的指南。其中包括关于向后兼容性的部分。

根据我的经验,从 5.2 到 5.3 的过渡非常顺利。我的应用程序遇到的唯一问题是确保我的 DateTime 设置是在 php.ini 中配置的属性,并过滤掉一些开始出现的过于激进的弃用警告。

PHP.net features a guide for upgrading from PHP 5.2.x to PHP 5.3. This includes a section on backwards compatibility.

From my experience, the transition from 5.2 to 5.3 went pretty smoothly smoothly. The only problems I had with my app was to ensure my DateTime setting were property configured in my php.ini, and filter out some overly-agressive deprecation warnings that started showing up.

白日梦 2024-10-18 22:26:16

不,5.3 不向后兼容,并且无论如何,它不应该被视为次要版本升级。
有一个页面专门用于不兼容的更改: http://www.php.net/手册/en/migration53.inknown.php
还要考虑您设计但已被 5.3 接受的功能。由于 php 不支持函数的重载或覆盖,这会报错。

No, 5.3 is not backward compatible, and by all means it shouldn't be seen as a minor version upgrade.
There is a page dedicated to incompatible changes: http://www.php.net/manual/en/migration53.incompatible.php
Also consider functions you have designed but have been accepted into 5.3. Since php doesn't support overloading or overwriting of functions, this will give an error.

宁愿没拥抱 2024-10-18 22:26:16

在大多数情况下,次要版本发布不会给您带来问题。你应该没事。

显然,如果您确实遇到任何问题,您需要确保设置了 error_reporting 以查看所有错误。 PHP: error_reporting

另外,请检查手册以了解 5.3 中的更改5.2: 从 PHP 5.2.x 迁移到 PHP 5.3.x

For the most part, minor version releases aren't going to cause you problems. You should be okay.

Obviously, if you do have any problems, you'll want to make sure you have error_reporting set to see all errors. PHP: error_reporting

Also, check the manual for changes in 5.3 from 5.2: Migrating from PHP 5.2.x to PHP 5.3.x

可遇━不可求 2024-10-18 22:26:16

有一些小问题。不推荐通过引用传递调用时间。有新的保留字(即 goto)。

There are some minor issues. Call time pass by reference are deprecated. There are new reserved words (ie. goto).

旧伤还要旧人安 2024-10-18 22:26:16

php 在所有版本中都没有向后兼容性。版本更新时经常会删除一些功能。当您必须升级服务器并需要更改 php 版本但某些 php 脚本不再适用于新的 php 版本时,就会出现此问题。您还必须更正 php 脚本,这是一项更大的工作。但是,如果该脚本属于其他用户而不是您的用户,则您无法升级这些脚本。这是一个真正令人头痛的情况,我厌倦了 php,出于向后兼容性的原因而切换到 perl。

php has no backward compatibility in all version. It often removed some functions when it changed version. The problem occurs when you have to upgrade server and need to change php version but some php scripts no longer work with new php version. You also have to correct php script which is a bigger job. But if the script belong to other users rather than yours, you can't upgrade those scripts. This is a real headache situation that I'm fed up with php and switch to perl instead for backward compatibility reason.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文