Is PHP 5.3 backward compatible with PHP 5.2?

I am starting to learn PHP. I would like to use PHP 5.3 because it is the newest version. I am working on a project in which I will use PHP 5.2 scripts that someone gave me.

Will they work fine even if I use PHP 5.3?

+8
php backwards-compatibility
source share
5 answers

PHP.net provides a guide to upgrade from PHP 5.2.x to PHP 5.3. This includes the backward compatibility section.

In my experience, the transition from 5.2 to 5.3 went pretty smoothly. The only problems I encountered with my application were to ensure that the DateTime settings in my php.ini were configured and to filter out some overly aggressive obsolescence warnings that started to appear.

+10
source share

No, 5.3 is not backward compatible and, in any case, it cannot be considered as a small version update. There is a page on incompatible changes: http://www.php.net/manual/en/migration53.incompatible.php Also consider the functions that you developed but were adopted in 5.3. Since php does not support overloading or overwriting functions, this will result in an error.

+5
source share

For the most part, minor releases will not cause problems. You must be fine.

Obviously, if you encounter problems, you must make sure that you have error_reporting to see all errors. PHP: error_reporting

Also, check out the change guide in 5.3 of 5.2: Migrating from PHP 5.2.x to PHP 5.3.x

+2
source share

There are some minor issues. Link forwarding time outdated. New reserved words appear (i.e. goto).

+2
source share

php does not have backward compatibility in all versions. He often removed some features when he changed version. The problem occurs when you need to update the server and you need to change the php version, but some php scripts no longer work with the new php version. You should also fix the php script, which is a larger task. But if the script belongs to other users, not yours, you cannot update these scripts. This is a real headache situation when I get tired of php and switch to perl instead for backward compatibility reasons.

0
source share

Source: https://habr.com/ru/post/651074/


All Articles