Hello and welcome to my little PHP tutorials. These posts are meant to help people learn and understand how to use PHP. I feel like a lot of people think that coding is complicated and hard to learn but if they only knew just how simple it can be, more people would give it a try. These posts are not going to drone on about useless stuff that you can read in the PHP Documentation, but will be simple, practicle examples that you can use. Let’s get started, shall we?
Creating a PHP File
PHP files can be created using something as simple as notepad or as advanced as PHP Storm. Depending on your budget, find a tool that’s suitable for you to write code in. Here are some free software suites to make writing code a bit easier:
Personally I’m partial to NetBeans but that’s only because that is what I got started on.
Here are the steps to create your very first PHP file using nothing more than Notepad::
- Open notepad.
- Write your opening PHP tag
- Write some hello world code.
- Close your PHP tag.
- Click file -> Save As.
- Name your file. Don’t forget to add the .php at the end of the file name.
- In the drop down called “Save as type” select all files.
- Select where you’d like to save the file.
- Click save.
Once these steps are completed, you’ve written your very first batch of PHP which should look something like the code below.
<?php //This is the open PHP tag.
//This is the hello world code
echo 'Hello World.';
//This is the close PHP tag
Next on the agenda, we will make PHP do some basic math. Catch you on the next post how bow dah?