   Why is PHP so popular?
  I've never really worked in PHP but it always seemed really messy, plus of course unlike ASP/JSP you can't re-use your code outside the PHP web-apps you write.And it seems like professional programmers mostly hate PHP, certainly my colleagues in serious software development circles deride it.So, is it only popular amongst those who are coming from a web development background? Or is it equally popular with those who learnt traditional C++/Java skills as their programming education?I don't want to attack PHP, as I said I've no real experience so I'd be happy to hear why my impressions are wrong - just keep it civil please.   
Quote:Original post by d000hgI've never really worked in PHP but it always seemed really messy...You can write messy code in any language. Generally, messy code is a sign of poor programming practices.Quote:...plus of course unlike ASP/JSP you can't re-use your code outside the PHP web-apps you write.I don't understand this statement. You write a module of functionality in ASP, JSP and PHP. Provided that module is not tied to the web response architecture, you can reuse that module in other applications written in ASP (technically, there are no non-web ASP applications; at a minimum they'd be WSH VBScripts), JSP or PHP. PHP has the statements include and require (and its require_once variant), allowing for modular code organization and reuse. PHP also has classes, and a dynamic type system akin to Perl.Quote:And it seems like professional programmers mostly hate PHP, certainly my colleagues in serious software development circles deride it.Most professional programmers don't actually know PHP. All they know about it is that it's the preferred languages of the unwashed LAMP masses. Its development is somewhat haphazard, and there's a dearth of overarching roadmaps (it's highly reactive), but it's very widely used to successfully build a fair amount of complex software.Quote:So, is it only popular amongst those who are coming from a web development background?It's really just popular among the "hardcore" open source crowd, and then secondly among individuals who just want to build a dynamic web site. This may have led to more use and formal instruction in web development, but Java is just as popular among web developers.   ;  Easy to get up and running. Large install base. Lots of helpful methods that make life easier. Huge developer community.One of the main problems with PHP is the initial lack of a design. Hence, you have differently named methods that don't conform a particular standard (e.g. some method names have underscores in them, while others don't).Additionally, there are some behavioural oddities and inconsistencies which could make life painful (but most of these were fixed with PHP5). Another major complaint is lack of a proper OOP model (which has also been fixed with PHP5).Personally, I make use of PHP for web projects because of the pros stated above, and I figure that one of the ways to be effective with the language is to be able know the unexpected behaviour for particular cases and how to handle them. The prevalent argument against this however, is that a programmer does not have to work around the shortcomings of a language or something along the lines of that.I also make use of a framework, which helps me stick to a consistent coding convention and keeps everything organised. If you're interested, I'd recommend CakePHP.   ;Quote:Original post by liquidAirEasy to get up and running. Large install base. Lots of helpful methods that make life easier. Huge developer community.One of the main problems with PHP is the initial lack of a design. Hence, you have differently named methods that don't conform a particular standard (e.g. some method names have underscores in them, while others don't).Additionally, there are some behavioural oddities and inconsistencies which could make life painful (but most of these were fixed with PHP5). Another major complaint is lack of a proper OOP model (which has also been fixed with PHP5).Personally, I make use of PHP for web projects because of the pros stated above, and I figure that one of the ways to be effective with the language is to be able know the unexpected behaviour for particular cases and how to handle them. The prevalent argument against this however, is that a programmer does not have to work around the shortcomings of a language or something along the lines of that.I also make use of a framework, which helps me stick to a consistent coding convention and keeps everything organised. If you're interested, I'd recommend CakePHP.I agree with you! I began my webdeving career a year ago and learned some php at the time, it was very easy to get into, you didn't have to know much at all, it was like C/C++ you could super easily do a 'Hello World' and gradually make it more advance. But the code did suffer, and as I began using PHP, I didn't know what a website really needs, so I could figure something out that I then had to implement on top of what I had, kinda like when I started with with C/C++. But it was still fun, and I learned alot.Then half a year after having done a little this and that I made a bigger website, but for this I developed a bit of a framework. In a way it was stupid, because being new to this, I didn't do all the right choices and there are some good ones out there prewritten and ready to use. And as the site grew I had to write lots of code over and over again, which is a sign of bad programming. But I did learn alot from it.A couple of months back I started looking into different approaches, it was nice knowing the basics of web development (What needs to happen and when). So I looked into asp.net 2.0, as I'm a huge fan of visual studio, but it didn't really appeal to me, too much 'magic' going on, unless you understood everything under the hood. I looked into some php framworks, but they all seemed a bit overkill. Finally I looked into the python based web framework django and it looks to be just what I want!/MindWipe   ;Quote:Original post by OluseyiQuote:Original post by d000hg...plus of course unlike ASP/JSP you can't re-use your code outside the PHP web-apps you write.I don't understand this statement. You write a module of functionality in ASP, JSP and PHP. Provided that module is not tied to the web response architecture, you can reuse that module in other applications written in ASP (technically, there are no non-web ASP applications; at a minimum they'd be WSH VBScripts), JSP or PHP. PHP has the statements include and require (and its require_once variant), allowing for modular code organization and reuse. PHP also has classes, and a dynamic type system akin to Perl.If you use ASP.net, you write C# (or VB.net etc) classes and use them in your ASPX pages. If you use JSP, you write Java classes and use them in your servlets and JSP/JSTL pages. In both cases you can use these classes in thick clients or back-end non-web server apps... with .net you can now even use them in Silverlight.   ;  I've often found PHP quite nice, there's boatloads of support for it and you name it, it can do it or somebody has extended its functionality so it can do it.I've got no experience with ASP Classic but I'm using ASP.Net for coursework right now and it's horrific for a number of architectural and behavioural reasons.  A quick Google search reveals hardened professional web developers who share the same views to myself.   ;  The problem with "hardened professional web developers" is that you don't say if this means "expert, experienced, programmers who've worked a lot with both" or "hardened, cynical people with poor software development skills who are set in their ways with PHP"... In my experience many of the people I work with who use PHP have never really used Java/C++ or written anything but web apps.Can you give some better support for your arguments?   ;Quote:Original post by ukdeveloperI've often found PHP quite nice, there's boatloads of support for it and you name it, it can do it or somebody has extended its functionality so it can do it.I've got no experience with ASP Classic but I'm using ASP.Net for coursework right now and it's horrific for a number of architectural and behavioural reasons.  A quick Google search reveals hardened professional web developers who share the same views to myself.Architecturally, ASP.NET is great. I find that the biggest source of contention with ASP.NET is the fact that it tries to hide the innards of the web away from the developer. Most new web dev's think that they can just sit down at ASP.NET and write an app the same way they'd write a WinForms app, without realising what they are doing is just plain inappropriate for web development.But once you sit them down and explain to them what's different and why it works the way it does, they usually understand a lot better and begin to appreciate what it offers.I personally would take ASP.NET over any other web language. Of course, it's the web itself that's the real WTF (It just wasn't meant to do what people want it to do!), which is why I'm switching over to Silverlight now.   ;  Yeah, I personally find all the clever stuff done through AJAX to be a horrible kludge :)   ;Quote:Original post by d000hgIf you use ASP.net, you write C# (or VB.net etc) classes and use them in your ASPX pages. If you use JSP, you write Java classes and use them in your servlets and JSP/JSTL pages. In both cases you can use these classes in thick clients or back-end non-web server apps... with .net you can now even use them in Silverlight.And if you use PHP, you use a templating language/system like Smarty to separate your markup from your logic. Same difference, really.ASP.NET is great, but by the time it came around it had the benefit of hindsight: it could observe the shortcomings - perceived and actual - of prior web development technologies and attempt to rectify them. It's not perfect, but the blunt truth is that there are no silver bullets. Silverlight is not a panacea, either (though WPF/E is insanely cool, and XAML generated with Expression wired to functionality created in Visual Studio is a powerful development model).   