Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am mostly developing on ASP.NET MVC and sometimes on ASP.NET WebForms. But when I hit a PHP web site, I always think that;

Should I learn PHP?

Assuming answer here is yes, where would be the first place to start and where should I go from there?

share|improve this question

closed as not constructive by MichaelT, GlenH7, Glenn Nelson, Martijn Pieters, Frank Shearar Mar 4 '13 at 23:31

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

I would suggest try taking a page you've developed in MVC and seeing if you can do the same page, but in php.

You already understand the mechanics of the page as you've done it once before. This would allow you to make parallels between the two different solutions and help you gain a better understanding.

You look up what you need when you need it, and to help with the learning, you fully read up on the topic so that you understand what you're doing, not just hacking code until it works.

Where to go from there? What topics did you miss that you think would be good to know? Read up on them and implement something using those concepts.

Next, make a site in php.

share|improve this answer

I would say coming from ASP.NET MVC to immediately dive into a PHP framework like Zend (not really a "framework", more like the .NET libraries, but it calls itself a framework) or Symfony (the only ones I'm familiar with, there are others obviously). Trying to use raw PHP will be like pulling teeth (speaking from experience here, I've tried and failed miserably) and most of the material you can find is going to be either written for total beginners and/or will teach a slew of bad practices (many of which you will already be aware of, but the fact remains that when learning a new language/platform it's important to learn it properly from the start).

share|improve this answer
I don't have enough rep to downvote, but I totally disagree. Learning a new language through a framework is terribly wrong. What do you do when you need to code a new feature, understand where a bug is coming from, or if there is a bug in the framework? This is true for any language: you begin using frameworks only when you feel you have the level of expertise needed to build the framework yourself, but lack the time to do so. I have entered the javascript world through jQuery, and boy I had a hard time unlearning jquery to use vanilla JS. – Xananax Jun 18 '11 at 3:28
That's a personal problem IMO. Learning something like PHP raw will just teach bad ways of doing things because it's very hard to find any good references, while learning via a framework will teach the proper way. – Wayne M Jun 19 '11 at 3:51

Should you? It's certainly an interesting language. It is a community-driven project, so it's a terrible mess at times. Object Oriented features have been added as an afterthought, and although they work passably well in the latest versions (5.2 & 5.3), they are still not what you expect from OO. Many functions pollute the namespace with aliases, sometimes the naming conventions differ...etc.
Still, I am in love with PHP for the exact same reason. I can easily switch from procedural to object-oriented at any given time, and mix at my heart's content. This allows me to prototype extremely quickly using procedural code, and then organize in classes when everything works.

Another reason for PHP is that it is completely open-source, and that it works out of the box on Apache, which is arguably the most flexible and robust server out there. The dev & the server box are extremely easy to set-up (under linux, it's a matter of one command-line, and under windows, installing xampp is enough). Oh and also both are completely and totally free.

So my main argument for PHP is ethics. I believe in open-source, and free, and I like that I can set up a working env on any PC without worrying about the OS, the license, or if it is going to work.
On a side note, Ruby is open-source too, albeit harder to set-up.

So how to start?

Pick up a simple project that does not use a database (text editor, calculator...), and try to build it. the community is a wonderful source of information. taught me my first steps. If you are an experienced dev, you will find the lecture somewhat boring, but skimming through it will give you the basics.
The various tutorials on devshed taught me almost everything that I could learn by reading.

share|improve this answer

Should I learn PHP?

I wouldn't particularly recommend it. If your web development experience thus far has purely been ASP.NET, and you want to broaden your horizons, I'd sooner look at Ruby on Rails, or Python and one of its web dev frameworks; if you want to broaden your marketability, I'd sooner look at the Java ecosystem.

I don't want to say PHP has no value, but learning it now, if you've never used it previously, seems a bit of a backward direction to walk in.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.