Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The point from jiggy2011 is rather that the differences from PHP 4 to PHP 5 didn't break much of the existing PHP4 code.

In PHP 4 for example you had an object model where the constructor was a method named alike to your class. In PHP 5 you got the __construct() magic method, but as a fallback, the method named to your class still works as constructor.

The same holds for properties defined with var instead of public/protected/private. For compatibility again, the var keyword is just interpreted as a public property.

As a third example, PHP5 came with an OOP system with support for interfaces, abstract classes and the final keyword. In PHP4, this wasn't available. So, there is no PHP4 code which uses these concepts, making them work in PHP5 as well. Obviously, this doesn't work the same way around.

There are some backwards compatibility issues, but these are minor in contrast to what you probably had written in PHP4 back then [1]

Now, for Py2 vs Py3 this is a completely different story. Py2 code doesn't run automatically on Py3. See this answer [2], as there were so many porting issues developers didn't had the time to overcome the overhead just to port the code. So: no, you can't compare the PHP 4 > 5 change to the Py 2 > 3 change.

[1] http://www.php.net/manual/en/migration5.incompatible.php [2] https://news.ycombinator.com/item?id=7581584



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: