DevPush

How to start coding PHP with an online editor

Introduction

If you are a newbie/beginner who is just starting to program with PHP, then the best way to start is by using an online PHP editor which saves you the hassle of setting up PHP locally on your system.

This way you get a feel for PHP programming before going through the time and effort required to set up a PHP web server on your local machine.

Go to the OnlinePHP website to access the online PHP editor.

onlinephp-site.png

How to use

Writing PHP code

Highlight all the text inside the main text area in the middle and press the Backspace button to delete the default PHP code.

Please copy the following code below and paste it into the text area.

<?php
echo "Hello World!";

There is an Execute Code button below the text area with a play icon, press it to run the code.

onlinephp-code-2.png

Another block will appear below the text area showing the output of the PHP code you just ran, you will see the text “Hello World” as the echo command outputs the text you specify ne

Change PHP version

At the time of writing the latest version of PHP is 8.3 with PHP 8.4 to be released shortly, OnlinePHP should be updated so that 8.4 is available.

The OnlinePHP editor allows you to select the PHP version to run the code with, in most cases, you would typically use the latest version (8.3), you only need older versions if you were working with existing PHP applications.

onlinephp-versions.png

You can select multiple versions to run the code on them and toggle on/off the PHP error types that get output.

Text editor settings

You can edit the text editor itself, here are the following common features you may want to change.

  • Font style
  • Font size
  • Change current theme
  • Toggle the output box position
  • Toggle HTML output

onlinephp-options-2.png

One setting I would recommend is changing the font size to 18px to make the text bigger.

Registering an account

You don’t need a user account to use the code editor however if you want the ability to save PHP scripts then you would need a user account.

If you want to go ahead and create an account then click the Login/Register button to be taken to the Login form.

You can easily create an account using social sign-in with either a Google, GitHub, or Facebook account, I used my Google account as I use it all the time.

onlinephp-login.png

When you want to save your PHP code click the Save or Share code button and you will be presented with some options.

Enter a title for your PHP code, click the I’m not a robot checkbox if it shows up and then click the Save / Share button to save the code to your account.

onlinephp-save-script-2.png

Click on your name in the top right-hand corner and then click the My Scripts option.

You will be presented with a list of your saved scripts that you can simply click to go back to.

onlinephp-my-scripts-3.png

As this is a free account you will be limited to 50 scripts, you can upgrade to a premium account to unlock a higher limit of 1000 scripts.

To upgrade you can send any amount on the donate page.

Conclusion

After going through this guide you are ready to start learning to code PHP using the OnlinePHP.io online code editor. This is by far the easiest way in my opinion to begin PHP grasp the basic concepts of it and quickly get to the point where you can code simple PHP features on your own.