2

I was asked to do some development with php5 (extending existing modules). I have experiences with Java EE, JSF2, general webapps. But did not code any php, not even a bit.

How difficult is it to learn php5? What are the main differences which I should be aware off?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • I fail to see how this question meets [these criteria](http://stackoverflow.com/faq#questions). We don't know you; we can't judge how well you'll take to a language. – Palladium Jul 23 '12 at 16:51
  • 1
    Sorry to have to throw a close vote @membersound `:)` - sadly this is a bit too discursive for this site. FWIW, if you're confident with Java you'll be fine with PHP. Hopefully the PHP you're to work with is OO-structured; PHP can be used procedurally, and hence a project is more likely to turn into spaghetti in the wrong hands! Edit: I recommend a auto-completing IDE, such as Eclipse or Netbeans - this will help you enormously to learn the language. – halfer Jul 23 '12 at 17:10
  • Yeah, in itself it's not a bad question, but I also see it coming that it is going to end up closed, oh well. How come SO still doesn't have a place for debates and discussions? – Mahn Jul 23 '12 at 17:12
  • @Mahn: it does - in PHP chat, for one. But equally, there are other places on the web that may be better for discussion. – halfer Jul 23 '12 at 17:21
  • I have yet to find a forum or a discussion site that has a comparable smartness of the people around SO to be honest :/ that's why I'd like to see SO expand beyond Q&A; chat is nice, but I personally don't have the time to sit there and idle until something interesting shows up. – Mahn Jul 23 '12 at 17:34

5 Answers5

3

It's easy. There are many, many gotchas that you won't be able to predict beforehand compared to other languages, but that's something you can only overcome by experience anyway, so just get started right away.

Be EXTREMELY wary of online tutorials however; pretty much everything PHP that is not on Stack Overflow is written by non programmers for non programmers, with a "this is cheap and dirty but will do" attitude — be ready to question every practice, and try to bring what you can from your Java knowledge where possible.

Read also:

halfer
  • 19,824
  • 17
  • 99
  • 186
Mahn
  • 16,261
  • 16
  • 62
  • 78
  • Thanks for the second link - it makes for a good antidote to the first one. I found the first rather depressing for its attitude towards a language that - despite its many flaws - is extremely easy to learn, extremely easy to deploy, and is (hence) very popular. The correct response to the first link should be, I wonder: _what has the complainant contributed to F/OSS to make PHP better? Or, what have they done to make easier to deploy?_ – halfer Jul 23 '12 at 17:17
  • It's important to be aware of these things either way; PHP has flaws, and we should not pretend that's not true. But like everything else, in the right hands it's capable of amazing things. – Mahn Jul 23 '12 at 17:29
2

I did this while ago.

In my opinion as php is a structured scripting language, is easier to use and learn than JAVA.

But, as it doesn't have robust structure of Java it will annoy you. There are a lot of inconsistency through PHP functions and it's structure. Even if it's easier to start and using it, working on big projects can be hard as there is not a good organization.

Ali
  • 21,572
  • 15
  • 83
  • 95
1

PHP is not hard at all. When I first started learning PHP, my CS professor told me it's pretty much the same as Java.

Since I'm still relatively new to PHP, the major difference between the two probably is that you don't have to define data type in PHP.

A couple sites that helped me along the way, w3school, PHP Manual

And a short way to use if/else statement by using ? and :

I recently discovered PDO which is a great way to prevent SQL Injection. Hope you find it helpful

Community
  • 1
  • 1
lusketeer
  • 1,890
  • 1
  • 12
  • 29
1

No, it's not 'pretty much the same as Java', but the learning curve is not that steep. With a lot of patience and lot's o' googling you'll find everything you need. I'm placing a lot of emphasis on patience if Java was your first language. PHP simply has it's own way handling stuff that some times is very frustrating. If you accept it for what it is and resent the temptation to 'do Java' with it you'll be fine. Past that it'll even be fun :-)

vector
  • 7,334
  • 8
  • 52
  • 80
1

I am so sorry to hear this. If this happen to me, I can imagine!!! Seems like it happened to you because of the "Lack of Developers" in your working place.

Anyway, PHP is not hard as Java, because it is not a programming language but a highly advance scripting language. However, you might feel it as boring too.

You can go to w3schools, refer php manual and of course PHP books like "Head First PHP and My SQL". But your question made me to think they are asking for a high level development. If yes, then you need time, or you have to talk with them, because you know, nothing can be learn by one day, because we are humans.

I strongly recommend studying a book, because online resources will teach you here and there, and most probably, the basics only. Once you learn it from a GOOD material, then of course you can find advance php tutorials (specially answers to questions).

PeakGen
  • 21,894
  • 86
  • 261
  • 463