LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2005, 06:41 AM   #1
hottdogg
Member
 
Registered: Aug 2004
Distribution: opensuse ,debian/ubuntu
Posts: 222

Rep: Reputation: 30
php 4 or php 5 ?


I want to learn php. Should i learn php 4 first or just straight to php 5?
Any suggestion would be appreciated.
Thx
 
Old 06-15-2005, 07:02 AM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
Quote:
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).

hth --Jonas
 
Old 06-15-2005, 07:25 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
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.

Yves.
 
Old 06-17-2005, 07:11 AM   #4
hottdogg
Member
 
Registered: Aug 2004
Distribution: opensuse ,debian/ubuntu
Posts: 222

Original Poster
Rep: Reputation: 30
Quote:
1) What do you plan on using php for?
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.
 
Old 06-20-2005, 01:51 AM   #5
BinaryBob
Member
 
Registered: Aug 2002
Posts: 117

Rep: Reputation: 15
(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.

Good Luck.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
php apache or php cgi - php learner rblampain Linux - Security 3 12-17-2004 11:10 PM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM
Updating php 4.3.1 from tar and keeping current php configuration with mandrake 9.1 mrjeep Linux - General 0 04-02-2003 07:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration