In this tutorial, you will learn how to setup a PHP development environment on your computer using XAMPP. You will learn how to install and set up XAMPP and test it out so that you are ready for PHP development!
We will be starting out with PHP and working with MySQL a little later on after covering the basics of PHP. These tutorials will be presented on Mac using XAMPP but you are welcome to use Windows or Linux and the steps should be the same or fairly similar for whichever OS you use. You can also try out another PHP development environment but XAMPP is a good choice for all platforms. Click here to download XAMPP.
You can also use a web-based programming environment like Cloud9 to code in PHP.
Watch the video below and then scroll down to see the sample code used in the video.
Sample PHP code:
<?php echo "Hello world"; ?>
Should I use the closing ?> tag?
If you are a beginner PHP programmer, it is recommended that you omit the closing ?> PHP tag at the end of your code if the file is pure PHP code. This will prevent any unwanted effects that may occur if you add whitespace after the closing tag.
If you do use the closing ?> then it is important that you do not add any other white space (spaces or new lines) after the tag. You can read the reasons why at the official PHP documentation site.
PHP Manual references: