Overview for PHP Developers

This hands-on experience article is written by an experienced PHP developer, and serves as an overview to help you understand the similarities and differences.

System Administration

Because Moxie.Build is a fully integrated system (the CMS, Database, Web Server is all in one package), it can be much faster than PHP and easier to setup. You don’t have to worry about setting up Apache or Nginx, MySQL, a (s)ftp server to upload the files etc., which are serious pain points for people new to system administration or can be difficult to set up correctly and securely even with system administrators that are fairly experienced.

It’s also extremely easy for developers to make a copy of the live system and run it on their workstation, so they can make changes, test and debug without impacting the live site. Often with PHP, you have to run an entire virtual machine to run a website on a workstation, in order to avoid conflicts, and it can take quite a bit of time to replicate the live system.

Language Similarities

Both PHP and MOX are similar in that they both like to think of everything as a string. MOX takes this one step further than PHP by not even having Boolean types. True/false is simply determined by if the string is empty or not, rather than PHP’s complex and sometimes confusing truth tables. They both have strong support for text and date manipulation. Both have built-In library support for modifying images, connecting to APIs, and support for various file types like CSV, JSON, and XML.

Syntax differences

The first big syntax difference is that MOX does not use semi colons to end a line, lines are simply ended by a new line, and you can continue the same line with an _. MOX also does not use () to signify a function call, you simply type the name of the function. Here is an example of PHP vs MOX syntax:

PHP Code: 

function hello(){
    //This is a coment
    echo "hello world";

MOX Code:

Method Hello()
    'This is a comment
   Html "Hello world"
End Method

In PHP, both " and ' can both be used for strings. MOX only supports " for strings, as ‘ is a comment.

Since MOX is a derivative of BASIC, it uses a lot more key words than symbols like PHP and other C-like languages. For example, it uses Function / End Function instead of function { }.

MOX does not allow you to have nested if statements, as they are a large source of programming error; complex code should instead be divided into additional Methods. Single line If statements are supported, but the syntax is If x then y.

MOX does not allow global variables, you must “pull” in input variables like get and post at time of use, rather than having a single $_GET or $_POST array like PHP.

Unlike PHP, MOX code cannot be used directly in templates. This facilitates a cleaner separation between the markup and the code. MOX code can be used to output HTML, but can’t be used directly in HTML files. Moxie.Build does use ##TmplTag## Tags as a placeholder for Content.Others records in a template, or as an adhoc output buffer in MOX, but not for executable code. There is also a global shorthand for Bootstrap glyphicons.

ForEach loops in MOX are more of a functional programming style, where you call a method to be performed on each item rather than just a plain loop like in PHP.


In PHP methods are just functions that are a part of an object, and functions are just methods not associated with an object. Methods in MOX are blocks of code that have no return value, and Functions are blocks of code that return one or more values.

In terms of PHP, the MOX Top Query is where variables are, and the MOX Work Query is used for database work or anything involving multiple records/items.

The database uses the concept of fields and records, rather than columns and rows.


Unlike PHP, Moxie.Build sanitizes all input variables by default, so you don’t have to run sanitization functions on input variables like in PHP, including values you are receiving to put into the database. This makes it immune to most security problems that PHP development has. Moxie.Build tries to avoid common security mistakes by handling them correctly by default, rather than relying on the programmer to remember them every time.

Errors in Moxie.Build are only displayed to a logged in database administrator, and are recorded in the log file. It also has a built-in email notification system for these errors, and for new IP addresses accessing the admin area. These error handling features avoid another common PHP pitfall where the programmer exposes errors and debug information to the user and that can be helpful to an attacker.

Next Steps

Be sure to review this page for a complete rundown MOX Language Syntax, and then check out some of the Development Examples if you have not already done so.