Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PHP 5.3 backwards-compatible with PHP 5.2?

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?

like image 761
snakile Avatar asked Jan 14 '11 16:01

snakile


People also ask

Is PHP 8 backwards compatible?

Is PHP 8 backwards compatible ? A: PHP 8 new Features also introduces us to unions in PHP 8. You can learn more about this in PHP benchmarks. This means that there is an issue with backwards compatibility if you implement PHP 8.0 union types, as this will break on sites running PHP 7.4 or below.

Is PHP 7 backwards compatible?

PHP 7 is not backwards compatible Before moving to PHP 7, you should detect if there are any compatibility issues with your site because once you switch you cannot go back to older legacy systems. This is why making the move to PHP 7 is currently elective and not mandatory.

What are backwards incompatible changes?

Non-backward compatible changes include the following: Removing an operation. Renaming an operation. Changing the parameters of an operation, such as data type or order.


2 Answers

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.

like image 95
Bryan M. Avatar answered Oct 02 '22 12:10

Bryan M.


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.

like image 25
Inca Avatar answered Oct 02 '22 12:10

Inca