Paul Alkema

Discussions on Web Development and Security

Paul Alkema

Entries Tagged as php

PHP vs. ColdFusion

July 01, 2010 · 74 Comments

PHP vs. ColdFusion

In my years I've found myself actively writing in several different languages. I've written full applications in ASP.NET, PHP and ColdFusion. My current primary languages are PHP and ColdFusion.

Throughout the years I've grown really fond of ColdFusion. In this article I'm going to explain the benefits & cons of ColdFusion over PHP.

Benefits to PHP

  1. Widely supported and has a huge community of people willing to help and answer questions.
  2. Open source.
  3. A vast amount of open source scripts available.
  4. A large number of shared hosting providers that are willing to offer hosting for very low cost. For instance $3.00 - $10.00/month.

Cons to PHP

  1. Is not the easiest language to learn.
  2. Development time can be very time consuming as everything is syntax based and requires a lot of code.
  3. Server settings are made through a text file called php.ini which can be a hassle and can make issues difficult to diagnose.
  4. Servers are typically apache, which often causes issues with file / folder rights.
  5. Doesn't have a very good template system compared to ColdFusion's custom tag based templates.

Benefits to ColdFusion

    1. Very easy to learn compared to PHP.
    2. Extremely easy to read compared to PHP.
    3. Writing ColdFusion applications require much less code compared to PHP.
    4. Coding applications is much less time consuming as ColdFusion is much more Robust than PHP.
    5. Although the Adobe ColdFusion server is not open source, there is an excellent ColdFusion alternative.
    6. The ColdFusion administrator is very easy to use and has a nice User Interface.
    7. ColdFusion has something called Custom Tags, which makes the managing and accessing of website templates a breeze.
    8. Very easy to use coldfusion OOP functions. Also allows for .NET and Java integration.
    9. Integrates very well with Flex.
    10. Extremly Robust with a vast amount of built in javascript packages like cfgrid, cfwindow and cftooltip. Also coldfusion has built in functions to allow ajax binding extremly simple.

Cons to ColdFusion

      1. Community is not as big. However, although the community isn't as big, I think that you'll find more ColdFusion programmers per capita than php.
      2. Some people don't like how easy to learn and read ColdFusion is because they claim that it's so easy to code that it's not like programming it's more like talking about code. Which is probably true.
      3. Those who use Adobe's ColdFusion think that it's expensive. Those who use Railo think it's free.


Want to see some code examples? I'll show you how robust ColdFusion really is.

The PHP code below, will return the columns firstname, lastname from the Friends table.

$con = mysql_connect("localhost","username","password");
if (!$con)
 die('Could not connect: ' . mysql_error());

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT friendId,firstName,lastName,nickName FROM friends");

while($row = mysql_fetch_array($result))
 echo $row['FirstName'] . " " . $row['LastName'];


Now look at the Coldfusion Example

The ColdFusion code below, will return the columns firstname, lastname from the Friends table.

<cfquery name="getMyFriends" datasource="peter">
SELECT friendId,firstName,lastName,nickName
FROM friends

<cfloop query="getMyFriends">
#firstName# #lastName#

Isn't the ColdFusion code just so straight forward to the point and easy to read?

This is just a single example of hundreds, no thousands of reasons of why I personally think that ColdFusion is better than PHP.

Have an opinion why you think one is better than the other? I want to hear it!

74 CommentsTags: ColdFusion · php