- The bases of php, what are they?
- Where does PHP run?
- How does php work?
- How is php used?
- And now our first code will be… Hello world!
- And is it already?
- Where to program php?
- Courses to learn PHP
The bases of php, what are they?
Here we go, let’s start with the first tutorial. I am going to share with you the basic notions to start programming backend with PHP.
I am going to ask what are surely the first questions that come to mind. They will help us locate ourselves, and that you will have to keep in mind when we get to work.
Where does PHP run?
This is the first question we must know how to answer. Let’s see, PHP is interpreted by the server software, in my case for example Apache server. This means that PHP is an invisible language for the user, that is, the browser or web client only receives the resulting page after the execution of PHP.
How does php work?
PHP, unlike other major languages such as C, C++ or Java, which are compiled languages, is an interpreted language. Among other things, this means that, for example, the errors that we have in our code will only be validated when the interpreter (our server that we will see later) encounters them.
If you are a user accustomed to other languages like the ones mentioned, this will mean that you will not be able to do a precompilation, at least when you start, since there are some extensions for certain platforms that will allow us to perform this step.
How is php used?
Getting started with PHP is really easy, and it’s what you like when you start. To start your first lines of code you just have to:
- Create a new file in any text editor. Later we will see which are the best platforms for this task.
- Put the file name you want with the extension .php
- Finally, now we only have to write ” #php” to indicate the beginning of php code and ” #/php” for the end of a block of code.
And now our first code will be… Hello world!
To make our first script we will write the following code in a file called index.php, a classic Hello World:
And is it already?
Well, once the previous step is finished we will have our first script, but in order to open it, that is, to execute it, we will need a server installed on our computer. For this step I am going to carry out another tutorial, where I will explain in detail what possibilities we have when it comes to choose and where to get them.
Where to program php?
You can start programming PHP in different software. But to get started you will need:
- An IDE or software for windows/mac like sublime text or visual studio code. Both are free so take advantage!
- An environment to develop, you can do it from your computer so don’t hesitate. You will need an installation like xampp or wamp.
- Next up you’ll probably need a course, or at least some decent tutorials. If you want to study a professional degree, without a doubt, DAW is your training cycle. If you are not in Spain or you want to do it online, you can do it with a php course on youtube or udemy.
Courses to learn PHP
Without a doubt, if you want to learn PHP from home, with all the comforts and at your own pace, you will probably need a course. I recommend the following from udemy:
- Php and mysql course to start creating your first website: here.
- PHP the practical way: here.
- If what you need are quality books, my selection of the 7 best books to learn php.