Will I suffer if I learn PHP4 compared to PHP5?
I'm a little interested into delving into PHP, and picked up a book from my library to learn more about it.
However, the book covers PHP4 (Library doesn't keep up with the times...), and I know PHP5 is the current standard.
Will a PHP4 book teach me things that are depreciated, useless, or just plain wron开发者_运维知识库g? Or could I learn sufficiently enough to be able to jump into PHP5 with no problems?
PHP4 is DEAD, you'll be filling your head with useless things specific to an old, dead language. Here's a free book that should cover 5 and up: http://www.tuxradar.com/practicalphp
Of course you can gather general programming tips from it, but it would be better if you had a more modern book to learn from.
Everyone is phasing out PHP4, so yes, at the worst you will learn things that are the opposite of correct, and at the least it will be a waste of your time.
Here's a decent summary of some of the stuff you'll be missing out on: http://hubpages.com/hub/RootShell
I strongly believe that you'll be a far better PHP5 programmer if you learn it from scratch than you would be if you learnt PHP4 first.
I learned PHP4, the company I worked for wouldn't upgrade, a year ago before I learned PHP5. For the most part the transition wasn't that bad and most the changes made my life easier such as all objects being passed by reference. The most frustrating part though is finding helping with PHP4 specific issues since nearly everybody is talking about PHP5.
If you can get a book on PHP5 you'd be better off but learning PHP4 won't hurt you.
Learning PHP4 is like learning COBOL at this time. There are still some companies that use it, but it expired a long time ago.
PHP5 is object oriented whereas PHP4 is not. PHP5 gave rise to new MVC oriented frameworks such as Kohana and CodeIgninter. These are too popular nowadays. So to survive in PHP world forget about PHP4 and get started with PHP5. PHP5 is the new standard. Don't worry about PHP4. As meder said PHP4 can be treated as dead. RIP PHP4.
If you control your own server environment, learn PHP5 and make sure you are running that.
If you are developing solutions that need to run in various environments (i.e. WordPress plugins), stick with PHP4.
However, you will find that "learning" PHP4 and PHP5 is not that different. Just a few additional and convenient functions that are available in the newer version.
Sometimes you will need to work on an old system that still uses PHP4. I suggest you start by learning PHP 4 and build onto it by learning PHP 5. That way you will have knowledge in both, know the differences and appreciate where PHP has come from.
It wouldn't hurt to learn PHP4, go for it.
精彩评论