Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

For example if we consider ActionScript2.0(based on Objects but programming does not implement much OOP ) vs 3.0(highly OOP) its like a whole new scripting language in the sense of approach, programming style,features you get the idea.

In PHP we can see current versions going from 3-5. brief version changes

  • Question :Developers who work on PHP is it easy to migrate from version to version?
  • Question :Are there any extensive compatibility issues, forward or backward?
  • Question :Does your project stick to a particular version till the end ?
  • Question :Does the programming style ,approach change from version to version?
  • Question :If you had to get started on PHP to contribute to a project built earlier versions, would learning the latest version be counterproductive towards this aim?

Some related topics i had come across on SE

How should I be keeping track of php script version/changes?

What is happening to PHP 6?


It would be Really helpful in understanding if you could answer this topic directly to the questions put forth.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

This is rather subjective, I think. Most people would say that PHP has been reasonably backwards-compatible. In that a script written for version 4 would mostly function on version 5. There are various settings and warnings you can enable which will notify you about potential problems (e.g. E_STRICT and E_DEPRECATED warning levels).

However, there's probably a number of people who have bitten by the odd compatibility-breaking changes between versions (here's a list for PHP 5.3 for example).

Edit To answer your direct questions:

Developers who work on PHP is it easy to migrate from version to version?

It's not particularly difficult. Again, this is subjective and depends on what you consider "easy". If you're moving from version 4 to version 5 (say) then that's more difficult than 5.1 to 5.2. But it also comes down to your question #4. Version 5, for example, introduced pretty major updates to the object model so while you can still run a script written for version 4 largely unmodified, it won't be using the PHP 5 class system and so might not be considered "idiomatic".

Are there any extensive compatibility issues, forward or backward?

Extensive? No. Scripts written for version 3 will run largely unmodified on version 4 and scripts written for version 4 will run largely unmodified on version 5. Going the other way (forwards compatibility) is a totally different story, and no language (that I know of?) ever attempts to be forwards compatible. The huge number of additional features makes it difficult to run a script designed for 5.3 even on version 5.2 (to be honest though, 5.3 was almost a major-version update).

Does your project stick to a particular version till the end?

For the most part, yes. But most of the "projects" I work on are actual websites. If I was working on a framework or library then updating it to work on newer versions of the runtime would be a consideration.

Does the programming style ,approach change from version to version?

Yes. Version 5 updated the object model to such large degree that (idiomatic) PHP 5 code looks quite different to (idiomatic) PHP 4 code. It's still basically the same ($variable, <?php ?> tags etc), but structurally it might look quite different.

Personally, I tend to use a framework (currently I'm liking CakePHP quite a lot) and they will typically introduce their own style and approach over and above the basic PHP engine. I'll often switch frameworks for different projects, too, depending on circumstances and what's best for the job (for example, I used to like Drupal, but it now feels too "PHP4-ish" for my tastes)

If you had to get started on PHP to contribute to a project built earlier versions, would learning the latest version be counterproductive towards this aim?

No, it wouldn't be counter-productive, but you have to remember that older versions basically have "missing features" compared to newer versions. For example, I really miss the better built-in DateTime class when I go from PHP 5.3 to 5.2 and older...

In Summary

Personally, I think you're putting too much emphasis on "compatibility" here. I write mostly Python and C++ code at work, and I also dabble in Java for Android development and even a bit of ASP.NET every now and then. Frankly, switching between PHP4 and PHP5 is almost trivial by comparison.

share|improve this answer
    
helpful answer.can you be more elaborate? –  Aditya P Mar 19 '11 at 13:14
    
Thanks, Really helpful –  Aditya P Mar 19 '11 at 13:28
current versions going from 3-5

Please do not consider PHP v3 or PHP v4 "current" in any way. In fact, as far as I can tell only PHP 5.2 and 5.3 have security updates these days so you really shouldn't use anything less.

The PHP manual has sections for migrating, describing the changes. http://www.php.net/manual/en/appendices.php

share|improve this answer
    
I am not Referring to any new development task. This Topic would come into consideration only on already developed projects started on prior versions. Which is why i am interested to know about the migration issues.I am not trying to argue which version is better either obviously given the choice any one would prefer the most recent versions.By "Current" I mean as in the majority of the existing work and Not the version of PHP itself –  Aditya P Mar 19 '11 at 12:13

I don't know much about version 3 but in the change from version 4 to 5 the only big change that affected me at all was with regards to classes and objects. If you had done any class programming your code would work on one but not the other.

share|improve this answer
    
oh? This is kind of contradicts what dean harding says regarding backward compatibility –  Aditya P Mar 19 '11 at 17:30
    
They completely redid the class/object model in php 5. See php.net/manual/en/oop5.intro.php –  Kenneth Mar 19 '11 at 18:09
    
In all other ways its backwards compatible. –  Kenneth Mar 19 '11 at 18:10
    
i guess you are saying class code is specific to version 5 and it wont run on version 4 i.e no forward compatibility as in any language right? –  Aditya P Mar 19 '11 at 18:14
    
Yes... there are some other small changes but in all the stuff I used my code was cross compatible except for the class structures. –  Kenneth Mar 19 '11 at 18:16

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.