ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Should i learn php 4 first or just straight to php 5?
quote (I think from `Dead Poets Society'): "The greatest freedom is to make up our own mind. I won't take that away from you."
... but I will give you a bit to think about:
1) What do you plan on using php for?
2) Which versions are supported by the places where you'd like to use it?
3) How big a benefit would use of php5+ features be?
If it's just for the fun of it, I'd say php 5 is probably the better choice (more features, idioms and paradigms). If it's for your hosted web page, check what the host offers. If it's for putting on your resume--learn both (first 4, then 5).
From my experience, all PHP versions are more or less the same, except that each one adds or extends functions.
So you'd better learn the latest one, so as to have a broad view of the language. Then for each project, you decide for a minimum required version of PHP, and you make sure not to use functions that won't work with this minimal version.
There's one exception, though: Object Oriented programming. Classes from PHP5 are very different from classes from PHP4. On this topic, either you dupplicate your code by testing the major PHP version, or you don't use classes at all.
Myself, I chose not to use classes, as PHP is not really done for that anyway, and as in most cases I can manage (admitedly less cleanly) with arrays.
1)For fun (personal web site, web UI apps, etc.), gain more knowledge about server-side web programming, and while doing all these, accumulating experience to build up my resume
I think i wll go for php4 first and php5 later.
Now, Let's say if i learn php4 first for a couple hours per week. How long should i stay coding with php4 as it acts as the fundamental for php5?
Do you know what i mean?
Sorry, as this is a basic question again. I need to plan like this so that the knowledges i gain know, would be worth it in the not-so-distant future. I'm running out a little bit of time, you know.
(The following is mostly my opinion from 4 years of PHP expirence)
For the things you plan on doing, PHP5 will offer little difference in functionality between PHP4. Because, as previously mensioned the big changes in PHP5 are mostly class/OOP related. Either one you choose will be fine. Other than classes a few useful functions and changes are present in PHP5, so you can start straight away with 5, but keep in mind the differences.
Back to your last question - How long to stay with PHP4.
If you are startign with 4, stick with it untill:
1) The things you are doing could be done better in PHP5. (This mostly has to do with classes)
OR
2) The hosting you use for whatever sites you make completely switches to PHP5.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.