Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This is the opposite question of this one. My purpose is that there is no need when you write only PHP5 code to have PHP4 compatibility. It is not helpful at all and due to differences between object models in those two version, it must be penalizing on interpreter performances (or am I wrong ?).

So my questions are :

  • is it possible to recompile PHP5 without retrocompatibility with PHP4 or to disable it in any other way to gain performances ?
  • if it is not possible, is there a project somewhere which aim that goal ?
share|improve this question

1 Answer 1

It's not possible because there is no need; everything (except for a small number of items) in PHP4 is basically a subset of PHP5. So the PHP developers didn't need to separately create a "compatibility mode" in order for PHP5 to run PHP4 code. It's sorta like, if the NBA suddenly changed the size of a regulation basketball hoop to be 2" wider in diameter, it would still automatically be 'backward compatible' with existing basketballs.

Anything that was going to be removed in PHP5 was already deprecated in PHP4, so properly written PHP4 scripts should run just fine in PHP5 with only minor modifications. The biggest "losses" aside from deprecated PHP3 features are extensions which are no longer included in a standard install of PHP5.

And the new object model has replaced the old one from PHP4, but aside from changing the copying quirks of objects, the differences between the object models are mostly in the implementation. So, again, most PHP4 scripts are likely to work in PHP5 with only minor modifications. And there is not explicit backward compatibility feature to be disabled.

So this is not an area of optimization worth worrying about. You would accomplish more by optimizing your PHP5 code and using Memcached or APC. And if you want to make PHP reject the use of deprecated code (to make your code future-proof rather than as a server-optimization), then just use the E_STRICT error-reporting setting.

share|improve this answer
    
My point was not on deprecated libs/functions but on the compiler perf. I agree that APC opcode caching improves performances, cause the code is not recompiled each time. I use it already. But the first compile phase could be faster if there were not 2 or more way to do the same thing (declaring a class for example has 2 ways, the PHP5 one and the old PHP4 one). –  Serty Oan Jun 19 '10 at 16:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.