views:

248

answers:

2

I started using PHP for creating online database driven applications in 1998. Back then, PHP 3 was the state of the art for web development. In the following years I've written a whole bunch of applications and a self-tailored framework for content management and document archiving (which I'm sure is ridiculous compared to solutions that came on the market since them.)

However, in 2004, I mostly stopped with PHP development because I aimed for a different professional focus. It was just the time when I started using OO programming techniques with PHP 5. I must admit, I still nostalgically think back to the time of very efficient web development.

Since then I've lost track with current developments in PHP and related technologies, maybe some of you guys can tell me:

  1. What has substantially changed regarding the language, syntax, technology, security aspects
  2. Can you name any best practices established since then?
  3. What CMS and application frameworks have accomplished wide acceptance for web publishing purposes? (What concerns CMS, I remember Mambo and Typo 3, which had a steep learning curve back then but seems to gain a lot of support)

And, probably the most interesting question: Would you still choose PHP for web development over Ruby on Rails (which I've never used), J2EE (which I've used intensely) and alike technologies? Please don't start a flame war here, I'd be glad to see objective arguments.

I'm curious to read your opinions.

+5  A: 

Language wise, PHP has followed mostly an evolutionary trail since 2004 with no major changes. There were some optimizations and bug fixes in later versions, and namespaces are coming in 5.3 but it's nothing drastic.

The biggest change in my opinion was the emergence of several high-quality frameworks (such as Zend's, CakePHP, SolarPHP, Symfony and others) that paved the way to an increased awareness to good practices and design patterns that were not mainstream in PHP before.

Such practices include the use of the MVC pattern (through a front-controller), database abstraction components, better support of internationalism and localization and more. Security practices have also evolved to meet higher standards (as PHP 5 changed some bad conceptions regarding security by deprecating some functionality such as gpc_magic_quotes() ).

Unfortunately, the major CMS and open-source application packages (such as eCommerce and forums) have remained largely procedural in nature and only increased in complexity since then. Some tried to migrate to an OO design (such as Joomla) but the results are mixed to say the least.

Personally I'm very pleased with the current state of PHP. The framework I use (ZF) abstracts most of the tedious details of application building leaving me more time to concentrate on domain problems. APC and xdebug are some of many mature PECL extensions available that I use regularly to optimize and profile my applications.

It somehow seems to me that PHP always has more diversity as opposed to Python with Django, Ruby with Rails and others where there is usually only one best choice.

In the end though I think that the backend language doesn't make much of difference - you can achieve amazing results with either one if you know what you are doing. Pick one that you are comfortable with (I liked PHP because of my C background), has the tools you need for the job and you'll be just fine.

Eran Galperin
A: 

I switched from ASP.NET/C# to PHP when PHP 5.0 came out since I was looking for something that had basic object-oriented features but which could run everywhere (Windows, Linux, UNIX, Mac) and which didn't have any of its own Framework baggage (Webforms). I've been very impressed with PHP over the years for its scrapiness and general stability.

From 5.0 to 5.2 there have been quite a bit of niceties added such as

  • filter_input (easy way to santitize user input)
  • json_encode/json_decode
  • ZipArchive (create and unpack zip files)
  • PDO (allows me to access SQLite databases and serves has an abstraction to other databases)

When PHP 5.3 comes out of alpha/beta I'll probably use the namespaces.

Another thing that has changed since 2004 is the free developer tools are now pretty awesome, the best two are:

  • Eclipse PDT (see my step-by-step workshop on how to get an Eclipse PDT developement environment running on your machine in 30 minutes)
  • Netbeans 6.3 for PHP yesterday I just tried out Netbeans 6.3 for PHP which has some very nice features missing in Eclipse such as easy-to-create macros, I also saw that it has SVN and CVS in a dropdown menu and drag-in web services, etc. This is worth spending a couple hours with to see if it's for you.
  • I've been on some teams which have purchase the Zend Studio based on eclipse for the profiler and debugger, but generally you can build this stuff with opensource tools, plug-ins, etc.

Currently I am getting back into ASP.NET, this time ASP.NET MVC which is not "web development for VB6 developers" as was ASP.NET Webforms but is is more Ruby-on-Rails-like in its approach, which also allows you to write test-driven apps more easily.

I have to say that moving from PHP to C# now is quite enjoyable, I love the following:

  • LINQ: a unique way to query almost anything including arrays, XML files and SQL databases, brilliant
  • just that fact that everything is type-safe and caught at compile time, very nice
  • intellisense of Visual Studio (even the free Visual Web Developer Express) is better than Eclipse/PHP
  • ability to overload methods and constructors and other niceties such as the properties in C#
  • and the Microsoft's speed of innovation in the last couple years is exciting: ASP.NET MVC, Silverlight, WPF, WCF, LINQ, Azure, Oslo...

Alas, the best of both worlds is where its at.

Edward Tanguay