With my departure from Zend this week I figured now might be a good time to reflect on the past 5.5 years. I will still be working with Zend as a contractor, most specifically to make sure the ZendCon 2012 content is handled properly along with some other tasks. But I will be spending my time being self-employed, working on mobile applications. There have been a few ideas I’ve had toying around in my head for a while and it’s probably time that I put my money where my mouth is.
I do like working with client/server-like architectures and so I intend to be building apps that have a fair amount of server-side processing to back it up. More details on that to come in the next few months.
I have decided that, for the time being, to use PhoneGap for my frontend development. There are several reasons for this. 1) HTML 5 is at the point where you can create compelling data-driven applications, 2) I didn’t want to have to learn a bunch of new languages/ecosystems to get up and running, 3) I wanted to use my existing skill set. OK, 2 and 3 are about the same, though a little different.
So the question was what to use for the backend development and, to nobody’s surprise I presume, PHP is my chosen way to go.
You might think that “Duh, the Zend guy picked PHP” but that’s not the whole story. When I first started using PHP I didn’t like it at all, but I learned it. My preference was actually Perl and Java. Tried my hand at C but pointers keep messing me up, even to this day. I have no idea why. But I got the call saying that Zend was looking for a consultant and I figured I’d give it a shot. How I got past the interview process, I don’t know. Maybe they were desperate. I liked the language but I was more interested in the challenges that I would have to overcome as a consultant.
But now that my work life is switching gears I have to make the decision again. Do I continue to do work with PHP or do I choose something newer and flashier to get the job done? PHP was my choice and it remains my choice. But why? Here are 10 reasons.
- PHP is stupid easy to scale – In the unlikely event that any of my projects go viral I will have the need to scale quickly. PHP does it quite easily due to its shared-nothing architecture. I can drop in more servers and increase my cluster size by orders of magnitude with very little configuration.
- I won’t need experts – If the event that my new ventures grow and I need to hire on more programmers I do not need the best and brightest to get the job done. PHP just works, in many cases. If you have an organization that needs to hire the best and brightest you are probably doing it wrong. The best and brightest are expensive, moody and prone to boredom. PHP allows you to set up processes that can allow ordinary programmers do extraordinary things. Very, very few languages can do that.
- It is tied to the web – HTTP is an imperfect protocol. But it is prolific, for good reasons, IMHO. PHP is bound directly to HTTP. You can run it in non-HTTP environments but it is built for HTTP. Since my communication will be over HTTP, PHP makes a lot of sense.
- When it fails, it doesn’t fail hard – Granted, you can fail spectacularly with PHP, but it probably won’t be PHP’s fault. Because PHP cleans up and starts over for each request, one request will not corrupt another. Other languages need a lot of plumbing to handle that. PHP does it by default.
- Frameworks – There are a plethora of frameworks to chose from. While some may consider that a drawback, I consider it a strength. If you need something that supports a complicated, or enterprise-like application you have the likes of Zend Framework or Symfony. If you need something simpler you have Silex or Slim.
- Best documentation on the web – Sure it looks like it was stylized by Tim Burton’s Joker but the content is prolific. Every function and method call has some kind of documentation and a great number of functions have tons of examples. Not all of the examples are good, but there are enough of them that you can get moving in the right direction quite easily. The only thing I wished that was different was that you could log in with Twitter or something like that to propose a change. I have enough logins as it is. (Correction, you can log in and edit the docs with a Facebook login). But even so. Best. Documentation. Around.
- Tons of blogs – PHP developers love to blog. Notoriety in PHPLand is based largely on how much you share information with other people and lots of people take this to heart.
- The PHP Community – This could also be seen as a 7(b). But there is no shortage of people who are willing to help you on IRC, Twitter or a host of other places. You just need to know where to look. Special mention must go to Cal Evans and Michelangelo van Dam who have put up with me and done more for me than I ever could have reciprocated, for various reasons.
- It integrates with everything – There are tons of interfaces to third party systems. Some of them are native like MongoDB or Memcache, some of them are PHP-based like Pusher. And that’s not surprising, really. PHP powers a third of the web and is used by banks, transportation, governments with tons of business critical applications. PHP should be a wide open target for anyone attempting to make a play for web-enabled applications.
- Dynamic typing – “But how do you know if you’re working with an int or a string?” By using your brain. HTTP does not do typing and so PHP does not do (strong) typing for scalars. Quite frankly, it makes complete sense to do it that way. Want an int? Cast the damn thing and stop complaining. Dynamic typing significantly reduces the amount of code you need to write and error conditions you need to check for.
- It plain works – Programmer’s have it wrong. The technical solution is not the end goal. Technology should be an enabler. Do you have a wonderful technical solution that doesn’t solve a problem? Bye, bye. PHP solves problems faster, easier and with a lower cost of ownership than almost anything out there. A lot of that is based on “assumptions” (or shortcuts) that PHP takes to solve a problem. Most often those shortcuts work, and the workarounds are very easy to implement (I’m thinking mainly about strict type checking here).
<Also, comments will be liberally deleted if you’re going to be an ass about this post />
Comments
billyildirim
I look forward to reading your posts about the Phonegap 🙂
afilina
Documentation is definitely amazing. Thanks to all who contributed to it throughout the years.
adamculp
Nicely put. Yes, keep us posted on how it goes with Phonegap. I am also looking at it after one of the talks at tek12 last week. Oh, and good luck on your new venture. I am sure you will do amazing things.
kschroeder
@adamculp I have been mostly impressed with Phonegap. Very easy to get started if you are doing something that is data driven. I wouldn’t recommend it for games, but being able to write JavaScript instead of Objective-C is a big plus in my book. One thing that I did learn is that it is a good idea to use the HTML5 animations as much as possible. The quality is better than the JS libraries.
dstockto
Is there still a Zend without Kevin? I guess we’ll find out.
kschroeder
@dstockto Well, I think that Andi’s or Zeev’s departure (not happening) would have more to do with there still being a Zend 🙂 I’m just lowly lackey who talks a lot
dstockto
@kschroeder Without you, Zend’s not saying much of anything though.
RBCud
Good article, but you missed the most obvious and important reason IMO.
Virtually every single web hosting company out there supports PHP.
When you’re trying to launch a minimum viable product, being able to find easy hosting quickly is very important. There is usually nothing too complicated to setup. That’s very important as well.
kschroeder
@RBCud That’s a good catch. That didn’t make my list because I prefer a base setup that gives me root and I install what I need. But good catch nonetheless.
tamasimrei
looks like you _really_ deleted all the negative comments
kschroeder
@tamasimrei Actually, I didn’t. And I wasn’t going to delete negative posts, only the ones for people who were going to make an ass out of themselves. And there were many on those other sites who were just being douches. Not all, but douchery abounded.
kschroeder
@tamasimrei I’ve now had to start :-(. Which is too bad. But I’ve been restricting the deletes to ad hominum attacks.
checarsner
Pointers are just arrays. They’re quite simple.
jasimq
A really good article. The best thing about PHP I like is that it really provides a very low cost way to get started. I calculate cost based on hosting/infrastructure and talent. Almost all web hosts and cloud providers support PHP and developer are a plenty.
On a little unrelated note, which PHP frameworks do you recommend for high traffic applications? I’ve always heard that PHP frameworks cannot compete with Django and Rails when it comes to high load, do you agree?
kschroeder
@jasimq I would have to disagree. I know of many high-load scenarios where PHP frameworks are being used. Several of the people working in those environments will (likely) be speaking on those topics at ZendCon this year. Python is “faster” than PHP and so Django might be faster (I don’t have numbers), but the last benchmarks I saw for Ruby showed it slightly slower than PHP. But even those numbers can be skewed as they were talking about raw language throughput and not frameworks. And even if they were better under load I would still dismiss the assertion that PHP frameworks can’t compete because there are many that are doing so quite handily.
Daniel15
@kschroeder Django is quite slow (due to how large it is)
kschroeder
@Daniel15 I’ve not ever benchmarked Django so my assumption was based off of raw speed. I stand corrected.
Daniel15
@jasimq Go for a framework with low overheads, such as FuelPHP, Kohana or CodeIgniter.
the327thmale
Dynamic typing reduces the error conditions you need to check for? It seems to me you need to check for all the same conditions as strong typing, in addition to checking that the variable type hasn’t been monkeyed with somewhere along the line.
kschroeder
@the327thmale I am talking about scalar variables such as string, int, bool, float. When they are coming in from an HTTP request they are _all_ strings and so the dynamic typing allows you to work with that string as the context dictates. Now, when you get into OOP you have all the strong typing you need, but for the scalar types, in an HTTP-based world, dynamic typing is a nice little feature.
KayEll
@the327thmale
It caues the same issues you see with anything that’s determined at runtime. It just means the compiler will allow you to write code that can blow up due to the condition. Same with javascript, if I declare var x = GetObject() and call x.Method(), but the returned object doesn’t define Method(), it will blow up. Dynamic typing didn’t fix the problem, it just let the compiler ignore the potential for one to exist.
justinlovell
I just know that this will be a fan boy blog post when “adding more web servers because I use X” scales.
Hello world, with the current server time, scales very easy! Scaling web servers is not hard; although, scaling your data is, and [insert your language] is not going to help you much over here.
squalsoft
I like this article. But ASp.net mvc also nice framework for web!
kennchongwo
@squalsoft True, it works wonders, i love it to the core
Daniel15
@squalsoft ASP.NET MVC is amazing. It’s especially awesome once you learn about its more complex components (like model binders, custom strongly-typed HtmlHelpers). It’s very powerful and very flexible, I love it.
indrora
@squalsoft But will it run on my 266Mhz Pentium running Linux 2.4?
bourgarelremi
1/ As said before in a web environment , the problem is not to scale the app but the data
3/ “It’s tied to the web” I don’t even see how this could be an argument. Can you compare to over technologies and say why PHP is more confortable than Java / .net … ?
4/ I definitely don’t understand your problem here : it’s the same problem with every language, unless you have a stackoverflow or an out of memory your requests will never corrupt each over.
5/ I agree but I don’t see how its an advantage compared to other technologies that also provide lots of frameworks.
6/Best doc ? really ? You might think that because you know php well, but it’s a big nightmare, there is no convention in the fonction/classes name, data is not typed so you never know what kind of things you have to type and you’ll never find a good IDE with a good intellisense support.
9/ Do you work with something else than php ? that’s the case for every major technologies
10/”By using your brain” so how do you use your brain when you have to know the type of a variable that was declared 2000 lines before ? (yes you have 2000 lines of code becasue you don’t need expert so you have this kind of code). To build good software you need to ease the developer brain by reducing the amount of things he have to keep in mind (that’s the purpose of abstraction).
11/ How does eery other technology do not answer to that ?
I read this post waiting for some good argument about the technology itself, not some trivial sentence like “it works” “it’s easy” or “there is doc”, we are in 2012 every web technology fits these requirements.
JossBeaumont
@bourgarelremi better comment than the orig post
joshuakissoon
@bourgarelremi This article is not comparing PHP to everything else dude, SMH. For your replies:
1/ Isnt the data what the app works with? Scaling the app is considering all of this.
10/ By using your brain yes!, of course your variable names have to be descriptive! would you think $count to be a string? or $name to be a number?
11/ “PHP solves problems faster, easier and with a lower cost of ownership than almost anything out there” – this is true.
bourgarelremi
@joshuakissoon
1/ In what php helps to scale the data ?? Do you understand what you’re saying ?
10/ And what is the type of $PersonNumber : “1/2 pers” (string) , 1 (int) [1,2] (array of int) … so let’s go to the hungarian notation, and indeed you’ll use your brain and your coworkers brain also. An other example : $Address, an object ? a string ?
11/ Why is this true ? About the lower cost maybe that’s true for .net (although all the tools you need are available in a free version) but it’s false for RoR, Java, or even node.js (and the quote you did is a comparison).
kschroeder
@bourgarelremi @joshuakissoon Re, #11 is based off of some data that I saw yesterday morning that, when we release it, will be making my point.
Zopieux
@bourgarelremi Thank you for that. I was using PHP for years as my primarily language (I was just starting to learn about programming and web dev makes it rather simple) but thanks to a friend, I discovered Python. Today, I don’t understand how can people stay stuck within this PHP nightmare. We’re in 2012, PHP just introduced the [a, b] array notation. What the hell? Python has great web frameworks. “Flask” can be used to deploy tiny apps in seconds without sacrificing clean and concise code. “Django” can be used to deploy big websites with its strong ORM. Both have wonderful (yet improvable) and clean documentations.
VladimirMalyk
PHP is a Windows in the web-development world. It’s ugly and tons of it everywhere. True story.
MJ2011
Nice article, I like it when people stick up for what they like. Personally, my background is VB, ASP and ASP.Net so if I was going solo, I’d stick with that. I’ve dabbled with PHP – and although I agree with some of your points – I never really adopted it for anything serious because I found it’s syntax a little ugly. Personal preference I guess.
RV
According to 7 & 8.) : Yes, there are tons of examples and documentations for specific problems/APIs. But as mentioned in point 2. the authors often arn’t real experts.
As example: One of the worst things I saw was a code snipped for RSA encription which was commonly refered to. It uses a list of 7 digit prime numbers which will result in an easy breakable encription. (Yes I know, performing encryption in pure PHP is nasty and there is also Pear, but sometimes you are forced to do nasty things).
So for simple task you have a great support, but if your query gets more complex, the results often become annoying. This can trap especially PHP beginners.
kschroeder
@RV Agreed that encryption is nasty. I do wish that we had better options there. Well, we do, but they aren’t well known and often involve third parties and cost.
bukko
I’m currently supporting a messy PHP app and it’s awful.
Whoever thought dynamic dependency injection was a good idea?
I’ll be really glad to get back to a .NET environment.
kennchongwo
@bukko Wellcome back bukko
hicham_hamid
If there are 10 reasons to use PHP 100 then there are 500+ to use ASP.Net!
Supah Fly
PHP documentation is the best? No.. I think you have it confused with MSDN.
kschroeder
@Supah Fly The MSDN documentation is definitely pretty good. No argument there
tuseroni
@kschroeder argument here.
i mean yes they do tend to have all their functions documented but it also tends to be the same documentation in the DLLs themselves, the community around .net doesnt seem nearly as helpful as the community around PHP (i dont often see comments on the vein of “if you are trying to do X you might want to try function Y as this function has issue Z when doing X” as i often see in php.net function comments. MSDN documentation seems so formal and particular in its verbiage while php documentation seems a bit more informal and lax with its verbiage
with web things i tend to prefer mdn to msdn as well, same thing, i think its just when the documentation is written by the people who USE the thing it tends to be less confusing.
ArtificialIntelligence
PHP is great, but Ruby and Python outclassed PHP. PHP is competing with good technologies but the downside is that, it’s not a software-engineer friendly language. Instead you have to assign a set of rules for everyone to follow, if someone don’t follow, then it leads to an arbitrary approaches with different styles and preference of every programmer.
shaded2
Kevin good luck with the new venture. It takes courage to leave a cushy job and be self employed full time. Mobile is definatey the way to go. I’ve enjoyed your articles thus far. I really hope you can keep em coming.
MehboobUrRehman
PHP is great, but Ruby and Python outclassed PHP. PHP is competing with good technologies but the downside is that, it’s not a software-engineer friendly language. Instead you have to assign a set of rules for everyone to follow, if someone don’t follow, then it leads to an arbitrary approaches with different styles and preference of every programmer.
MehboobUrRehman
PHP is great 🙂
Alvaro
Who talking about the senile and gaga PHP? Omg, what a narrow mind! To say a statement like that you should be a f* expert with a wide experience developing with several tenchnologies and frameworks. In that case, you should know that this is the most ignorant and stupidest article ever written. I recommend you never say a statement like this at any interview or professional gathering, otherwise you will show up your weaknesses. Every feature, business issue, etc. needs to be analyzed to know exactly which technology is the most suitable to solve it. There is no statements in IT, you can’t think in that way if you want to become a IT expert some day. All depend on the challenge you will have to deal. Remember, every technology has advantages and disadvantages, and just your theorical knowledge and your experience can determinate which is the best solution.
NetVicious
12. It runs in all places (Windows, Linux, *BSD, *ux, ….)
https://wiki.php.net/platforms
GothAlice
@NetVicious Runs everywhere, but runs everywhere slightly differently. The mail() function, as an example, uses SMTP on windows and doesn’t understand some of the extended options. Oddly, SMTP support is plain missing from the Linux version. :/
savire
@GothAlice @NetVicious But it does deliver the mail right? So unless you are building mail specific domain apps which needs to send thousands of mail per sec, why bother about them? Most of clients does not care about it. If you need to build such apps then it has it’s own solution and you can use them instead. So the fact just use the suitable language for the problems and you won’t need to hate any languages at all. I do love them all because they helped me getting my job done.
GothAlice
@savire No, the mail() function given different operating environments can break or alter the meaning of what you pass it. E.g. on Windows a period on a single line is removed, on Linux not so much. On Windows Return-Path gets set from From, not so much on Linux. Using “Name <[email protected]>” might not work on Windows, but only in the to address according to the docs, and not even on Cc or Bcc according to a comment. (An interesting failure considering it’s a spam detection issue as well.) One commenter on the docs tells you to use r as a separator on Windows and n on Linux. The function isn’t thread-safe on “some” Windows platforms. And that’s just one function that behaves inconsistently. “@fopen(‘http://example.com/not-existing-file’, ‘r’);” is an amazing hydra of environment-based inconsistency! Good luck building environment- and OS-agnostic code around these; the amount of double-checking and conditional boilerplate you will have to add is gob-smacking.
If you architect systems thinking that efficiency doesn’t matter then you’re only preparing yourself for a world of hurt when it _does_ begin to matter. I’ve written 10,000 email/second delivery platforms in PHP. It required a convoluted, distributed, on-disk queueing/locking system and multiple servers. In Python (using my marrow.mailer package which, yes, is modelled on phpMailer 😉 I can get the same performance from a single server, without the complexity of distributed queueing and in one tenth the development time. (Starting up within a Python web app auto-scaling subprocesses as delivery managers, each with their own scaling thread pools is about 10 lines of code.)
I’m not sure what you mean by “if you need to build such apps then it has it’s own solution”. :/
You can use any programming language for pretty much any purpose—PHP-GTK is proof of that! It doesn’t mean you should be writing full text indexing in Brainfuck—I did as an experiment and my gods was it painful—or complete web applications in hand-coded C. Compared to a number of alternate languages PHP is rarely, in my eyes, the right solution. (Unless, as mentioned by others, you need it to be hosted on anything and everything up to and including a potato. Rarely an issue on the scalable web applications I work on. 😉 I did embed PHP in a Python app once as a tempting engine, a job PHP (a self-professed Hypertext Processor) excels at. 😀
Apologies if this sounds to flame-y, it was not my intention but I am very, very tired at this point.
GothAlice
@savire Speaking of web application in C, adding C code as optimizations to a Python app is as simple as dropping the .c file next to your .py files and adding a line to the setup script. Of course, writing the C code itself is less easy. ;P
GothAlice
@savire Last one on this thread, I promise. (Damn I wish livefyre let you edit posts!) A Google search for “high performance PHP mail delivery” (without quotes) produced a single relevant result on the first page about using PEAR’s Mail class in a forking arrangement. That’s really not a good sign!
Dhara Mistry
@GothAlice Hey there, Dhara here from Livefyre. We’ve a new stream releasing soon, and along with comes the ability to edit comments, so stay tuned 🙂
NetVicious
@GothAlice @NetVicious I develop on Windows but the servers normally are on Linux. No problem with mail function in both systems. On Linux it uses sendmail to send emails, If the Linux box it’s not configured correctly the mails will not go out. For the creation of the mail in PHP I use the PHPMailer project. (http://phpmailer.worxware.com/)
GothAlice
@NetVicious Indeed! phpMailer is pretty darned good, and as mentioned in a reply elsewhere it’s what I based early versions of marrow.mailer on. I practically force my PHP hosting clients to use it (or PEAR:Mail) as mail() is disabled on my servers—there’s no sendmail binary available at all. Unfortunately it’s still synchronous (made worse by a socket connection and TCP slow-start) and last time I looked makes a new SMTP connection for every message. Performance-wise it’s still a terrible solution, even if it is “good enough”, as blocking user UI on mail delivery is flat-out unnecessary and any delay is bad UX.
@Dhara Mistry Thanks! 😀
ManuelK
I really like PHP, but comming from “traditional” programming, I find it hard to come up with a proper IDE for coding – and more important – debugging (and which doesn’t cost several hundreds of dollars).
indrora
@ManuelK I’ve used Notepad++ and Komodo Edit (Windows/Anything, respectively). For debugging, I’ve used webgrind and ChromePHP (http://www.chromephp.com/). Debugging for me is more often though wrapping #ifdef DEBUG around some echo’s.
ManuelK
@indrora I’m using Sublime Text for editing. ChromePHP looks interesting, I’ll have a look at it.
adamculp
@ManuelK I noticed your comment about $ for an IDE. Have you looked at PHPStorm? Only a $99 price tag, and I have found it pretty full featured. (started using it a month ago)
ManuelK
@adamculp Reasonable price tag, I think I give the trail a try, thanks for the hint!
tremchez
@adamculp Also have a look at Aptana Studio (free, Eclipse based), it’s not perfect but I haven’t found anything better.
kschroeder
@ManuelK PDT (free) can be used with the Zend Debugger (free). Plus you can tack on any plugins that you might need, usually for free.
ManuelK
@kschroeder PDT is for Eclipse, isn’t it? Sounds promising, I’ll have a look at it, thanks!
fusion27
@kschroeder Agreed, I just spent weeks bouncing between ST2, NetBeans & Eclipse PDT.
fusion27
@kschroeder +1 Eclpise PDT. I use the CodeIgniter framework to build & Git for source control. PDT + EGit plugin is perfect for me and I was able to find a beautiful color scheme. Good form.
SeanJA
@fusion27 @kschroeder You should take a look at Netbeans for php too (pdt always felt too cobbled together whenever I tried it). Netbeans has git built in as of the latest version. I have also recently fallen in love with Sublime Text 2 (free to try, ~50 bucks to use indefinitely) as my general purpose editor for opening up individual php files
fusion27
@SeanJA @fusion27 @kschroeder Sean, we appear to be lie-minded! I’ve tried Netbeans and really liked it, the only reason I use PDT over NetBeans is for CodeIgniter code completion, haven’t quite had time to figure it out. Was very pleased with NB’s git support, I know what you’re saying about PDT feeling cobbled together though, feels a bit disjointed.
savire
@kschroeder Never used any advanced IDE since it’s not really needed, lol. I can do rapid development with just Notepad++. That being said learn your stuff and you won’t need an IDE. Unless you are lazy, because most IDE just mess your codes and add trash to it :(.
morsaPT
@ManuelK I use Netbeans for everything: PHP, CSS, JS. It simply works with very well with code completion and snippets. OOP oriented works very well. I truly recommend it! 🙂
ManuelK
@morsaPT Thanks, will try it out!
SeanJA
@ManuelK @morsaPT Doh… I replied up top to say the same thing
Nilpo
@morsaPT
I agree with NetBeans. My other choice is CodeLobster which is also free.
KayEll
@morsaPT @ManuelK
+1
If you’re going to use a tool, use one with a pedigree
tremchez
@ManuelK Also have a look at Aptana Studio (free, Eclipse based), it’s not perfect but I haven’t found anything better.
adamculp
@tremchez @ManuelK Aptana is not bad, but I have had my fill of the bugs and troubles of using an Eclipse based IDE. (free or not) Contrary to what many say, Eclipse sucks IMO. (crashes, corrupt workspaces, slow loading, slow response, memory hog, etc.) But that is really another topic for another time. After years of forcing myself to use Eclipse, thinking it was a great tool, I have finally given up. Netbeans is nice, but PHPStorm truly does rock.
tremchez
@adamculp I guess we all feel the same about Eclipse and Aptana prior to version 3 was awful but at this point it IMO beats both Netbeans (terrible UI, slow, java-based) and PHPStorm (I don’t like the workspace and workflow, it’s too Windows like for me and it doesn’t handle PHP 5.3+ features well enough). I’m still on a hunt for a perfect PHP IDE and I review new/updated IDEs every 3 months or so but Aptana 3 is currently the best (Mac) PHP IDE out there.
Nilpo
@adamculp
I don’t think it’s a discussion for another time. You are very correct. Eclipse is an extremely powerful IDE with a solid development history. That’s why it has outgrown its pants. If you’re looking ofr a one-size-fits-all IDE for multiple environments, you really can’t beat it. But for more purposeful development there may be better choices out there.
DukeW
Completely agree, one small thing, dew to the fact that PHP is extremely forgiving it should never be the first language a developer learns.
GothAlice
I can only assume you’ve read Eevee’s “PHP: a fractal of bad design” article¹? It goes into great depth as to why, technically, PHP is an absolutely terrible mess of a language. Three of the many points are dedicated to the problems of PHP’s typing system. One of the sad tasks of deploying PHP updates to my clients’ servers is when regressions hit, which is far more common than it should be. Broken crypt (seriously, how do you regress in a function perfected 20 years ago?) and most recently completely non-functional DNS resolution.
For every point in favour of PHP there are 20 or more points against it.
¹ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
kschroeder
@GothAlice Yep, read it. I the spent some time trying to figure out why so few of those problems have ever hampered my real life development efforts. That’s not to say that it’s always peachy. PHP is is, of course, an imperfect language. I won’t argue against that. But the perfection of a language is not what matters to me at the end of the day.
KayEll
@kschroeder @GothAlice
Because you know what you’re doing? The primary problem with PHP is that it’s the everyman language, and as such, every man uses it, regardless of whether or not they know what they’re doing, or whether they’ve read the instructions.
I don’t know that I agree with you on how well PHP scales, it’s been my experience that the way it scales is silo’d enough to experience diminishing returns to a greater degree than competing platforms, but it certainly gets the job done if all you need it web.
asusmx
Most of you miss the most important statement in this, he is “self-employed”…I’m there too, and after investigating the demands around me, for the web, one language stands outs for all the reason above, yes php/mysql. I have a extensive MS background, knowing VB ever since ver 1.0. If you write code as an “employee” for some firm, MS is the most likely solution. But when you work on you own, as a startup, you can’t afford to buy Windows Server at 999$ each, which also requires $1500+ machine to run on. But linux on a P4, that you can, and have to if you want to succeed. Second point, hosting company are better at php/mysql. .NET on a hosting company is more expensive and noticeably slower. As far as all the details about language (strong typed and such), you quickly learn to deal with. No language is perfect, I mean none. But for a self-employed, startup, web oriented development, php is the best solution even with some imperfection. Anyway, this is my story, I have try to sell .NET solution for web apps, I could not compete, with php/mysql, I work everyday. Talking about that, I need to get back to my work…
bourgarelremi
@asusmx While I agree with your argument (it’s really hard to find a good .net 4 host) Do you really start a company thinking you’ll be alone forever ?
asusmx
@bourgarelremi
I might not be alone forever, but I may not be with php forever either. At this point in time it is. A business plan is always changing. I have put aside .NET cause it wasn’t the best tool then. If things changes and .NET ends up being the right tools, I will use it again.
GothAlice
@asusmx Best is, unfortunately, a relative term. The best solution I’ve found so far for the tasks my clients have given me has been Python, though I do maintain legacy support for older PHP applications I’ve developed. More and more web hosts are providing excellent alternate language support, such as WebFaction. These days, though, I maintain my own virtual servers on Rackspace Cloud, and previously Amazon EC2.
I’m a performance nut. I run Gentoo servers (rice ahoy!) tweaked to fully boot in 6 seconds (and compile the Linux kernel from depclean in 54), run a heavily reconfigured Nginx, and my Python applications, for the most part, can withstand extended C10K hammering… with a single application server. PHP only _begins_ to approach good performance with a third-party bytecode cache (I use xcache for various reasons), run in FPM mode with proper scaling limits, using an on-disk socket, and even then the fact I have to run Suhosin and outright disable a number of core functions to have any semblance of security is concerning to me as a managed hosting provider. Stability is an issue as well with the regressions I’ve mentioned. Hell, the core of PHP barely has a unit test suite… though this is improving slowly over time.
Most of my Python application virtual servers, those C10K ones, only have 256MB RAM allocations, making them close to dirt cheap. (WebFaction managed hosting, as an example, is ~$9/mo for that allocation.) Even Facebook resorted to compiling PHP to C (HipHop) for performance, and even _then_ they use Python for their realtime messaging and push notification systems (Tornado).
Now, let me qualify this with the contributing factors of why I switched from PHP to Python: mind-blastingly awesome ORMs and template engines, real package management w/ versioned dependencies and a huge library of available packages, resident-in-memory and thus zero setup overhead per request and the ability to use in-process caches, integral bytecode cache w/ optimization levels (i.e. strip asserts, docstrings, and ‘if __debug__’ blocks in production), true threading support (important for full text search ranking and background e-mail delivery), and the fact that the language itself is far more internally consistent.
PHPAMF, as an example, only communicates in arrays, integers, and strings, and typecasts to integer eagerly. This means that if my Flex application sends an MD5 that starts with a number, PHP sees it as a number. (Real problem, fixed by prepending an ‘x’. That’s stupid, let alone ignoring the other datatypes the protocol supports!)
kschroeder
@GothAlice @asusmx Have you looked at Zend_Amf for handling Actionscript calls?
GothAlice
@kschroeder Alas, no, I switched to Python long ago and added PyAMF support to my web framework, WebCore about two years ago.
kschroeder
@GothAlice Too bad. The Zend_Amf integration in Flash Builder for PHP had direct 1:1 mapping of PHP objects to ActionScript value objects and the PHP service endpoints were automatically added into the ActionScript/MXML code.
GothAlice
@kschroeder 1:1 mapping is why I switched from PHPAMF to PyAMF, also, performance since the PHPAMF PHP extension (at the time) broke associative array encoding terribly and Python has native support for compiled C extensions with dynamic loading at runtime. (C modules are just like Python modules.)
I also use a dynamic endpoint configuration manager (with heavy caching, obviously) with the only drawback that misnamed calls only error out at runtime.
savire
@GothAlice Point is, don’t judge any languages easily. The thing is you got time or not. Clients won’t bother which languages you used. They just want their problems solved. So why bother being picky with the languages? It’s just the tool, what’s important is your programming skill. Yes I used most of the languages mentioned here with different projects either on inside a company or like now when I’m self employed. True when we self employed we will think about the budget since why spend thousands of $ when we could solve a problem with free $? That’s what’s called smart decision is.
GothAlice
@savire I don’t, I really don’t. I’ve programmed PHP for about 10 years. Python for nearly as long. Perl for four years before PHP—I dropped CGI for mod_php like CGI was on fire. Basic/Pascal/C since I was a child. Interestingly enough, all of these things are free. Unfortunately, maintenance isn’t free, even if the language is. No PHP code I have ever seen (and I’m probably up to the billions of lines at this point, what with running a shared hosting service) has been what I would consider easily maintainable. I do honestly wish it weren’t so. 🙁
Alvaro
Deleting the bad critics about your article, you just demonstrate what type of person you are. I really pity you. Good luck in your life, you will need it.
kschroeder
@Alvaro Agreed on most counts. If you look at the comments I have kept several from people who are critical. Critics, I have no problem with. Feel free to critique my points in a thoughtful matter. But if you call me stupid, ignorant or narrow minded, especially when you have no idea what my experience, history and expertise is I don’t think it is unreasonable for me delete your comments. Respond to this article in a thoughtful, respectful manner and we can have a discussion about it. If you can’t do that, take a hike. Personally, I would prefer the former.
GothAlice
@kschroeder @Alvaro I was initially worried about my posts being redacted, and I greatly appreciate the fact that they haven’t been despite not agreeing with the principle of the article. 🙂
Alvaro
@kschroeder I just said the truth. If you can not stand that, I am not going to waste my time with you. Time puts everyone in the right place.
GothAlice
@Alvaro That was simply unnecessary. <insert random personal attack here> Note that by saying you’re not going to waste your time you have proven yourself to be a liar… by wasting your time. Good day, sir.
yaph
“I won’t need experts… PHP just works, in many cases.”””
PHP often just doesn’t work
yaph
“I won’t need experts… PHP just works, in many cases.”””
PHP often just doesn’t work and you need experts to tell you why or read through scores of documentation comments, support requests or bug reports.
I guess you haven’t looked at many other language docs, if you think that PHP has the best one. It could certainly be worse, but often important information is only found in the comments sections, and not incorporated in the main docs.
Dynamic typing is both good and bad, but PHP is so full of surprises considering types, that it will often be the cause of very hard to identify bugs.
There are good things about PHP but for me the negative aspects outweigh them easily. As you may have guessed not my language of choice.
mrlee
I’m always surprised by the hate for PHP. It’s a perfectly good language and lends itself to web programming nicely. Why bother comparing it to .NET people? I can’t believe we are back to the old windows vs unix argument.
I started working with PHP as an afterthought. Having worked with .NET (ASP, C#), Django, Rails and a bevvy of other languages I always wanted to try PHP but I thought (still do) that the documentation on PHP.NET is horrible. There are sometimes good eamples but a.) you have to read them all to find one and b.) they are usually for the easy stuff and I don’t need 50 examples on how to do a select.
My university offered a class on PHP and I took it. Since then it is my preferred choice for server side web apps AND it is also a good replacement for unix shell scripts.
Working for yourself is difficult and fun. Good job on getting rid of cable, now uninstall the WoW client and you are ready to go!
ericgreenn
Yes, use what gets the job done and works well. Most importantly in timely way.
No WoW! Come on, you’ve got to live to 🙂
opwernby1
Hmmm… Sorry to have to say this, but the fact that pointers screw you up in C explains exactly why you’ve written this article from this point of view. Not to put too fine a point on it, but PHP isn’t a language: it’s a cobbled-together mishmash of inconsistencies which puts friction burns on the inside of Edsger W. Dijkstra’s coffin, it makes him roll in his grave so much.
mrlee
@opwernby1
Hey opwernby1, what is the URL to your blog. I want to read more valuable commentary from you. Brilliant nuggets such as ‘PHP isn’t a language’ and the thing about Dijkstra are improving my coding abilities by the second.
kschroeder
@opwernby1 It also might have something to do with the fact that I never (needed to) learn C and have never had the time to get into it.
SeanJA
@opwernby1 Ah, so you use ASP.NET and look down on us php developers with our non-language. Gotcha.
EdATODI
@opwernby1
c is good for writing filters and such; but, for a real program, done in a reasonable time frame, no way – Objective c maybe, C # maybe, c ++ maybe, but not c.
Pointers don’t bother me. In c, pointers, recursion and the like are expected, which is part of why it is not suitable for large scale app development in the modern world.
PHP and CFML are basically advanced code generators targeted to the web, that run in real time. Hence, they are excellent languages for web development. C and all it’s variants are not especially good at this. Too much time is spent on either minutia or idiosyncratic .Net libraries, and/or variable type declarations that read like encyclopedias. Tools, frameworks and generators only go so far, the programmer gets left to weed through the rest of it.
I can do in a few lines of CFML or PHP what would take a few screens full (and multiple linked modules) of C #.
kokopelli
I am an independent contractor and I have a Job with a firm. For the firm I write C# ASP.net MVC3, using nuGet and EF. I love C#!!! But for my contract work, it’s always about PHP and Zend MVC. I use Backbone, Require.js, Underscore for the Javascript end.
That being said, Kevin, I agree with you 100%. I also am an advanced Actionscript developer, using RobotLegs and such….I just recently setup 2 huge servers with Citrix Zen, installing WAAS (Windows 7), Windows Server and a few CentOS servers. So now I can develop independently using C# and PHP. It also allows me to make money hosting the clients project.
So, Kevin, I say, you do what you have to do to get the bills paid. My Mortgage company doesn’t want to hear me say, “I couldn’t pay my mortgage because I was banking on Ruby and Python but no work came my way…I passed up all the PHP work because other developers talk bad about PHP and Linux….etc….etc….etc..”
That being said, Kevin, get your money son!!!!! See ya at the crossroads!!
As for the haters….well…..thanks for making me rich!!!
Peace
savire
@kokopelli +1, Let the haters say stupid things. Well it’s just work and many paid for it. I do have fair knowledge on most of others languages but well when your clients ask and wants faster development time why would forced them otherwise?
GothAlice
@savire @kokopelli If there was any one single factor which clients would flock to, there would only be one programming language for any given problem domain. Fact is, there’s enough work to cover them all! 🙂
As for haters saying stupid things, well, they have valid points, too. The more time you have your nose buried in documentation means the less time you’re actually solving your client’s problem. (Digging through docs = solving _your_ problem, not your client’s.) Having excellent documentation is one thing, but needing to use it often is a bad sign. Again, from the PHP fractal article:
“A language must be predictable. It’s a medium for expressing human ideas and having a computer execute them, so it’s critical that a human’s understanding of a program actually be correct. [PHP is full of surprises and unintuitive behaviour.]
“A language must be consistent. Similar things should look similar, different things different. Knowing part of the language should aid in learning and understanding the rest. [PHP is wholly inconsistent.]
“A language must be concise. New languages exist to reduce the boilerplate inherent in old languages. A language must thus strive to avoid introducing new boilerplate of its own. [PHP has more than its fair share of boilerplate, most of which is used for safety and security.]
“A language must be reliable. Languages are tools for solving problems; they should minimize any new problems they introduce. Any “gotchas” are massive distractions. [PHP can be quite flakey, reference that odd MD5 as a number issue I mentioned earlier.]
“A language must be debuggable. When something goes wrong, the programmer has to fix it, and we need all the help we can get. [PHP can be quite opaque with a lack of stack traces and overly complex error handling and reporting.]”
Debugging your code is likewise solving _your_ problem, not your client’s, and is a direct symptom of a failure to adhere to the rules above. Of course, given enough time you’ll learn the quirks, the irregularities, the gotchas, and begin to code more defensively. All of that headspace dedicated to the exceptions to the rules (or every single instance if there is no rule) can be put to better use more fully groking a problem domain, groking algorithms and patterns, etc.
Fact is, for me at least, in Python I very rarely, if ever, need to revisit a line of code I’ve written. I’ve written a complete MVC web framework with grade-A features in the course of two nights, and that framework has been stable and nigh-on bug free (one security issue, two performance rewrites of specific functions, etc.) for three years. I’ve written a hybrid async+threaded C10K HTTP/1.1 web server in pure Python in one day. (It compiles to 171 opcodes!) Boilerplate? Near-zero.
Of course, use the tools you are most familiar with. Use the tools that best fit the job. Dismissing valid complaints because a “hater” doesn’t agree with you, however, could pass for the definition of folly.
(And yeah, pairing hosting with project development is a pretty awesome way to maintain residuals after initial development is complete. 🙂
savire
@GothAlice @kokopelli Yea anyone wish that for a language which can solved all problem. But the truth is “none” so far had been really done that. Because well “the universe” do love chaos because it’s bringing new opportunities for new “thing” to be unfold and so the human problems is.
I do understand that python is had it’s own advantages because well Google pick them as one of their based development languages besides Java. But to wrapped all your posting (Sorry I was away for this couple weeks due to my offline clients), I does not really care what languages used really as long as the problem solved with a fair discretion then it’s fine because there’s no such thing as 100% perfect codes, they will fail over time. Recently I do have developed using Python, PHP, Java, C at the same time for a client project since it’s incorporating different platform and I could say that I love them all. Since I’m into game development I do use python and lua for scripting along with some C#.
I’m also had done development in Pascal/Delphi, VB/VB.Net,C#,Java and many other languages peoples might does not heard of, lol, yeah I mean that and down to assembly languages for Micro-controller and say what I do loves them all because they had their beauty. Some of you called it their flaw but I called them it’s their uniqueness. Each had it’s own distinctive usefulness because each problem had their own set of constraints. So it’s actually depend on you how to use your experience on picking which of those languages can be used optimally to solved the problems in moderately optimal solution.
sigwhite
No. http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
matt_pedley
For me it’s number 11, it just works. I’d agree with some of the comments such as not ideal as a first programming language but as someone who has come through the Windows Application route I mostly work in PHP now. I prefer it for most web applications compared to .NET.
I have seen some terrible and dangerous PHP coding and understand why some think that itself is a reason why the language is bad. Reality is though, if you have programming knowledge it is a brilliant language that gives results.
howmnsk
have a look at a Language and database called MAPPER
EdATODI
I like PHP; but, CFML is better.
It has all the same benefits as PHP (as listed above).
It also has better security, faster development time, better management interfaces and, generally speaking, faster page execution times on high end servers.
ericgreenn
A very nice article. I’ve read the PHP haters articles who gone on and on forever about how bad PHP is. But I still use it for anything web. I’m mainly a C# programmer but love PHP and think c# could learn a few things from it. Strictly typed can really get in the way of doing big things with a little code.
ericgreenn
A very nice article. I’ve read the PHP haters articles who go on and on forever about how bad PHP is. And they are very right that it can be a mess but I can still get the job done quickly with it. I still use it for anything web. I’m mainly a C# programmer but love PHP and think c# could learn a few things from it. Strictly typed can really get in the way of doing big things with a little code.
GothAlice
@ericgreenn I find it quite interesting how many PHP-positive comments here are from developers with a Microsoft (C#, ASP, or VB) background. For comparison, I have a C/Pascal/Perl background—and programmed in PHP for a not insignificant number of years. This correlation and comment by ericgreenn seem to indicate to me that C#/ASP/VB must be absolutely terrible if those languages could learn something from PHP. VB has full inheritable class-based OOP, something PHP still doesn’t have quite right. Again I’ll reference “PHP: A fractal of bad design”. It’s worth a read for a great listing of technical through social lessons from PHP.
Case in point, I asked about processing a query string formatted string into an array of variables, and asked in #php why parse_str populated the local namespace even if I passed in an array to populate. I got back a dozen responses of “because PHP sucks”. On the official support channel. Apparently I had to wrap it in a function so I wouldn’t regress to register_globals all over again. :/
hakeem_tunde
It’s nice to cee people’s view. Php is one of d cheap programming Lang 2 start with talkin of scripting Lang. That said I wish u good luck.
Commentary: Why Do People Hate PHP? | PHP Tip A Day
[…] Comments I recently read Kevin Schroeder's blog post about 10 Reasons To Use PHP. Then — silly me — I started reading the comments. It only took a few before the obligatory […]
EricHerrmann2
You might wanna see this: http://www.reddit.com/r/programming/comments/udxkj/xpost_from_php_10_reasons_to_use_php/
kschroeder
@EricHerrmann2 I’ve seen it all 🙂
euyisenga
I’m not good in php but I think I like it and hope too know it.
asusmx
Here is something else to think about. For my work I use CMS et program of the sort (Joomla, Drupal, SugarCRM and son on). I wonder why they use use php. Oh yeah their is is few of those for .NET, but those for php are definitly the most popular. Even hosting company offer excellent support for those, they install it and configure them for optimal performance on their server setup. I would really be missing a lot not to use them. But hey, php is not strictly type, I shouldn’t use it…
savire
@asusmx Well then again because nowadays shared php hosting is still popular and most of it cost less than windows box version which offer latest .NET technology supports and believe it or not for heavy-weight portal written in .NET with enterprises level if you does not had the knowledge of tuning it up then be ready to face bottle-neck. Been having those problems on some of my clients before.
danaketh
I can’t say if I love or hate PHP. I just live with it. It’s one of the things that helps me to pay the bills. Sometimes it makes me pretty angry. That’s when it throws errors for no visible reason or I’m forced to fix something written by an idiot or using Zend Framework. But it’s able to make me happy again, because when I take a look how much work is there for me and how much I’m getting paid for it and compare it with those who do “real languages” (whatever that means), I have to laugh. I’ll be gladly the one who “writes scripts in cobbled-together mishmash of inconsistencies” as long as I’m getting paid 3-6 times more than those with “real languages”.
After years with PHP, I know most of the problems and strange things that it contains but so far the only real annoyance is the inconsistent syntax. The rest I can live with because I’m not really seeing them anymore.
savire
@danaketh Well they inconsistent because they tried to covers all and when you do that with all of those open-source peoples enthusiast who loves the languages be prepare to face this as some of the result. I think it’s somewhat a bargain which need to be paid of.
AGHICT
Good,
I hope people check this post before say ASP
bjori
“The only thing I wished that was different was that you could log in with Twitter or something like that to propose a change.”
All the doc pages have an “edit” button which allows you to login with facebook, google account, or just modify the documentation anonymously.
In case you don’t have the time to edit the docs, or you don’t know how to fix them – or you believe they are simply wrong, you have the “report a bug” button which allows you to make suggestions quickly or mention what you believe is wrong 🙂
kschroeder
@bjori Well crap! I had totally missed that. I thought that it was just a typical wiki login. Thanks for the correction.
aloksupremacy
Time waste 2 padhne ke baad maine ise padhna bhi jaruri nhi samjha…
upr0
In your article the only sentence which you emphasis was that only stupids use php and php does not need so much talent … dear friend never compare a language like php which is not fully Object oriented with a powerful language like C# with is fully object oriented and a powerful company like microsoft support it. I suggest C# to any programmer. be sure if you are 10 in programming with help of microsoft and using C# you will be 20 at least. be sure.
good luck
thank you for your information.
SeanJA
@upr0 A 10 in programming? Is programming now an RPG? Does microsoft help you level up with their documentation?
savire
@SeanJA @upr0 I’m now lvl 99 with all those Microsoft certified thingy, lulz, ROFL.
Mr CSharp
I’m a C# ASP.NET specialist and here’s my counter against your points:
1) PHP is not the only one with scalability in mind. ASP, then ASP.NET can do the same. It’s not like this platform came out of nowhere. Scalability is usually determined by the servers and the host software you’re hosting it on.
2) PHP is very similar in nature to Javascript. You still need the skilled developers to write the code. Why do you think ASP.NET has been so much more popular with the business for the past 15 years? Also, if there is no expertise in doing the code, imagine the maintenance on it by someone else. With PHP being much like ASP, the UI code logic gets inlined with HTML code. I just cringe when I go back to doing ASP and all the UI logic is interspersed with HTML. Imagine if you’re looking at that code with a plain old text editor trying to find a malformed tag? So, IMHO, PHP actually requires more skilled developers even though a lot of kids use it in their basement before becoming web developers professionally and then learning other commercial languages in the corporate world.
3) Yeah PHP is tied strictly to the web just like HTML is tied strictly to the web. And so is ASP, ASP.NET, Web Services, and a wide variety of web languages. What’s interesting though is that scalability to not have it strictly tied to the web done correctly through frameworks and patterns. With .NET development, the separation of backend logic vs UI markups greatly uncouples the two. Therefore, a Windows desktop UI piece can be fitted into a desktop, web, or a mobile device in event that the client wants that.
4) Failure of runtime code is actually dependent on the server host software it’s running on. Usually these are thread safe and the application is guarded from other services to prevent a total server lockup.
5) There are tonnes of frameworks everywhere for the most common languages used for the web and other types of code development, not just for PHP. jQuery, for example, is one framework for Javascript while there are couple of dozen more tailored for what other developers want. ASP.NET has tonnes upon tonnes of frameworks, but really, do we need to have that flexibility and have a cowboy style of development where cowboys run wild and everyone does their own things. Think about the maintenance costs, standards, and the time to learn the plethora of frameworks out there. Why don’t we just concentrate on a small number of patterns and a single framework rather than “hey, this is something new. Let’s go try it out” kind of attitude.
6) I tried doing PHP long time ago and I felt the documentation sucked as compared to that for Microsoft’s ASP and ASP.NET. Why? It’s because there are more people out there in the corporate world doing ASP.NET right now than there are kids in the basement doing PHP.
7) There are also tonnes of blogs on HTML, Javascript, jQuery, and especially C#, LINQ, and ASP.NET classic and MVC. PHP is just one small piece in the whole WWW.
8) Everyone grows up and need to earn money after coming out from the basement and into the harsh reality of the corporate world.
9) Sure PHP integrates with a lot of other integration server, I have to give you that. But the integration software might not be cheap even if the PHP software is for free.
10) Dynamic typing – cripes, I hated ASP, VB, VBScript, and Javascript for having that. With C#, strongly typed variables are way easier to manage code. With weakly typed variables, you don’t know what the variable is until you use it. Going back to the previous points about the skill level needed – think about a guy who goes while and make a variable a date value then with the same variable later on, turns it into a decimal value, then a string and then back to a date. How confusing is that? A skill developer will try to do away with this and make everything consistent.
11) You can make anything work in programming. Back to point #10, it’d be better if things are compiled ahead of time to make sure you don’t get any runtime errors. With Javascript, it’ll run as well, but at least the browsers can hide the errors for general users. With HTML, it’ll render in IE even if the tags are malformed. So, what’s the point of this point?
SeanJA
@Mr CSharp PHP isn’t just for the web, you can do “normal” programming for it too (it just usually gets used for the web).
We are currently using Java, perl, and php in our “corporate” environment… also php can be compiled too.
savire
@Mr CSharp Lol, easy there, remember, the language’s just the tool. If you are stuck with one language then good luck there, because you does not really understand how the “world” works.
As far as I concern PHP had done many of my clients projects successfully so whatever case peoples saying about it, it just bring me money and nowadays like it or not, PHP still dominates most of the web and enterprises do had incorporates them too. The thing is enterprises usually does not care what languages used they just care when something happen they had someone to takes care of it, or to be exact to be blamed for. That’s how it work and it will always be.
And yes, you can do a lot with PHP not just the web. Do some research. Of course that would be the same for other languages as well. So if you truly are developer then any languages is beautiful in it’s own way.
upr0
@savire @Mr CSharp
You speak too much … if you think php is a programming language I offer you object oriented languages then you will understand what our programmer’s world works. if you claim php is object oriented I should tell you until you can not use page life cycle feature of object oriented programming method in php you can not claim that php is an object oriented language. php is a good language JUST FOR WRITE tiny exploit . I understand you son, I have so many students like you, please search more and write more program with object oriented languages I am sure you will notify how world works, or you can emphasis on your opinion and earn some little money.of course for those kind of programmer which compare any thing with money this is usual to be satisfy with some Peny or Cent. good luck Young Programmer. :-h
kschroeder
For those who were talking about PHP development as being something that basement programmers with no real importance are doing, this is a survey that Zend just released today (http://www.zend.com/en/community/state-of-php-in-the-enterprise?src=li). I knew about the survey results when I wrote this but could not talk about them. So when people talk about how useless or amateur or un-enterprise-ready PHP is, here is DATA to show that the “enterprise” is actually taking PHP quite seriously. PHP is much more pervasive than a lot of people think and it is the driving force behind a lot of business.
I encourage you to read this report. But here are a few select quotes.
“the demand for PHP developers is growing faster than any other server-side development language. There are currently nearly 25 million (public) web sites running PHP, including such high-profile sites as Facebook, Wikipedia, and Yahoo. Additionally, comparing job trend data to other Web scripting languages, PHP could be ranked as the most popular Web language today.”
“in our survey, 60 percent described their PHP applications as revenue generating, or critical in nature, while only 15 percent described them as being used for non-critical purposes. For those planning to use PHPin the future, only 13 percent described their planned PHPapplication as non-critical in nature”
“The majority of those who chose PHP did so to deliver higher quality, an improved user experience, and optimal application performance, all while saving costs with increased efficiency.”
“97 percent of those organizations that are actively using PHP plan to use it for future application development.”
I am sure that this comment will generate another dozen links to “A fractal of bad design”. That article is right about it’s charges about PHP’s design. The problem is that the charges don’t matter. It’s like saying that I’m a lawbreaker who deserves prison because I have a lead foot. The proof is in the numbers. PHP has no corporate support like .NET or Java. Is not new like Ruby or CS-sound like Python. But yet when you look at the amount of web work churned out by PHP it is on par with the primary corporate languages and eclipses the others.
Not bad for PHP getting it all wrong.
GothAlice
@kschroeder Interesting article. The results are skewed and nearly useless without context, of course… with context hidden behind a signup-wall. Way to go.
“the demand for PHP developers is growing faster than any other server-side development language.” — natural fall-through from large quantities of “unwashed masses” entering into web development with PHP as their first language. Normalize the numbers of developers, then compare.
“Facebook, Wikipedia” — I’ve mentioned before that Facebook actually compile their PHP to C (ALL of their PHP code is compiled to one ELF executable!) and use Python for realtime work which fairly excludes them from fair comparison. MediaWiki, while having an obviously huge deployment, is a really difficult to work with codebase; far more complicated than it needs to be and hardly a shining beacon of best practices or maintainability.
“Additionally, comparing job trend data to other Web scripting languages, PHP could be ranked as the most popular Web language today.” — Again, a pointless data point. HTML is the most widely deployed markup language, but you’ll find few business documents formatted using it.
“in our survey, 60 percent described their PHP applications as revenue generating, or critical in nature, while only 15 percent described them as being used for non-critical purposes.” — I’d need to see a comparison against other languages to be sure, but I’m fairly confident this ratio is relatively unchanged for other languages, too, if you ask the right people.
“higher quality, an improved user experience, and optimal application performance, all while saving costs with increased efficiency.” — Even the most poorly coded Python web application—barring calls to time.sleep()—runs faster and is more “efficient” than an equivalent PHP application. The difference in deployment architecture alone accounts for this. User experience has little to do with underlying language on the web, as in any application worth its salt views (template/css/js) are external.
“97 percent of those organizations that are actively using PHP plan to use it for future application development.” — Vendor lock-in is a good thing? My Python code runs in CPython, Jython (mmm, using Python in Java enterprise deployments), PyPy, Stackless…
“The problem is that the charges don’t matter.” — Very true. Quantity does not equal quality, however, and I’d love to see reports on 5-year and 10-year support and maintenance costs. The only truly valid comparison between languages, development speeds, security, etc. would be between a single application developed with all of the languages to be compared, though. “Compared to your next most-used language” — would help to identify context, here. If their next-most-used language is C, C++, etc. then this type of comparison is pointless.
(Oh, and Python is hardly CS-sound; like any scripting language it’s very difficult to prove correctness. ;^)
Not having to worry about SQL injection or HTML injection attacks at all in Python and Ruby (extremely high quality ORMs, real template engines that compile to language runtime bytecode) is two fewer things for a developer to concern himself with, as an example. Real packaging and dependency resolution (even multi-versioning) is better. I’m pretty sure that given one or two 40-minute presentations I could convince anyone starting a new project to use Python, even if they don’t already know the language!
/devil’s advocate
Thank you for updating with the link; I’ll see if I can find somebody with an account to squirt me the whole report for some light evening reading. 🙂
kschroeder
@GothAlice Support and maintenance costs are definitely one of the reasons why enterprises choose PHP. In my own discussions with customers that often comes up as a significant factor in their purchasing of our PHP solutions.
And no, you could not convince ANYONE to start a new project using Python. The reason that PHP is being chosen over Python to run web-based applications is not because someone didn’t have the right presentation in front of them.
My Draft Technology Analysis | Srong An's Blog
[…] Kevin, S. 2012, 10 reasons to use PHP, ESchrade, viewed 30 August 2014, < http://www.eschrade.com/page/10-reasons-to-use-php-for-your-mobile-project/>. […]