Exploring the differences between CFML and PHP - Oyova Software
Skip to main content

Exploring the differences between CFML and PHP

We all know that CF vs PHP vs whatever else out there has been an argument that has gone on for years.¬† Instead of comparing which is better than the other, let’s take a look at what makes them similar, or better yet, show how one language does it versus the other.

Let’s look at an example of just how similiar these languages are together:

CFML: <cfset myVar = url.recordID />
PHP: <?php $myVar = $_Get['recordID']; ?>

Now let’s take a look how using another cornerstone piece of development, the conditional if statement¬† looks side by side.

CFML:
<cfif url.record EQ "123">
<cfelse>
</cfif>

PHP:
<?php if($_Get['recordID'] == "123"){ ?>
<?php }else{ ?>
<?php } ?>

Of course the deeper you go into the languages, each has their own unique syntax, and commands to handle certain situations.  Take Arrays for example: in PHP you have far more power to work with Arrays than you do with CFML, but in CFML, the Structure Functions make dealing with and exploring complex data structures a snap.