4 ms·
PHP5 was almost completely backwards compatible with PHP4, Python 3 has much larger changes.
by jiggy2011 13y ago
PHP5 was almost completely backwards compatible with PHP4, Python 3 has much larger changes.
- Macha 13y agoJust the entire OOP system changed. However, nobody noticed because nobody used the OO features in PHP4.
- jiggy2011 13y agoIIRC PHP5 mostly added features to the OOP system so old code would still work even if it was suboptimal.
- nolok 13y agoTo this day, old PHP 4 objects code still works in the lastest PHP version The difficulty of upgrade for PHP didn't come from the devs having to redo / revalidate parts of their code for little to no immediate benefit (like in Python's case) but in the shared hosting companies (un)willingness to make the upgrade when the scripts their users wanted (phpbb, wordpress, ...) worked fine with PHP 4. And that's why these various projects agreed to a common date of "end of support" for PHP 4, sending a message to hosting companies to either upgrade, or not be able to deploy wordpress and co anymore
- ma2rten 13y agoI know of a small company (won't publicly shame them) that to this day is actively developing a php 4 code base. The reason is that they use a couple of libraries which do not work in php 5 and don't have the time/manpower to port it.
- pearjuice 13y agoAutomattic isn't a small company.
- mscarborough 13y agoDo you know what libraries can't be ported without a lot of effort? I haven't heard that in a long time.
- juriansluiman 13y agoThe 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 http://www.php.net/manual/en/migration5.incompatible.php [2] https://news.ycombinator.com/item?id=7581584 https://news.ycombinator.com/item?id=7581584