Course 1: Learn PHP for beginners

Course 1: Learn PHP for beginners

The first lesson, Learn PHP for beginners will contain the following topics:

  • PHP language definition
  • Why do we use PHP as a programming language?
  • What do we need to start with a basic program?
  • How to start writing PHP code

PHP Language Definition

PHP is the most widely used programming language for the web today. 

PHP is very popular because it has a relatively simple syntax compared to web frameworks.

However, PHP can not only be used as a single language for designing a single web project, we always need to learn other languages ​​with it such as HTML and Css.

Why do we use PHP as a programming language?

If we want to build a website for example using the WordPress platform, from scratch we will need to know the basics of the language.

If we want to make a tool or something called Plugin; Or create a theme for a website, we also need to know the language.

What do we need to start with a basic program?

In order to write PHP code, we need a code editor which is a program that you can download to your computer. You can use one of the following programs:

  • Android Studio
  • Text sublim

start Learning PHP code

Before you start, you should know the following and try to memorize it because you will use it a lot.

There are specific signs that must be used and we will go through them all, and here is a summary of some of these signs:

  • the quote “”
  • comma,
  • semicolon;
  • regular interval:
  • the point .
  • parentheses ()
  • crescent moon {}
  • Arched square []
  • dollar sign $
  • equal sign =
  • equals sign with parenthesis =>
  • Smaller or greater parenthesis ><
  • slang sign *
  • Division mark /

The first thing, you should know that all programming languages ​​have distinct tags, for each one separately. And here in the programming language there are basic tags, which are as follows:

1- The first tag (opening and closing)

<?php ?>

This function is the opening tag of the language code, and immediately after it the closing tag.

Remember, you need to use it frequently, so this is the main code for us today.

2- The second tag (echo print command)

If we want to print something, so that it appears after writing a specific code, here we will use the echo command.

We use this tag when we create a specific code, and in the end we want to show the result of what we typed in the browser.

The following example will demonstrate the use of the echo command.

<?php echo "Hello World "; ?>

As we can see above, in the previous example we used two tags , the first is open, then print, and then close.

Important note: We put the semicolon immediately after the quotation marks, which is essential when typing the print command.

Examples of the first course:

Examples of tags related to Lesson One:

If we want to create a note within the code, we will use the following:

  • The opening tag
  • division mark
  • star tag
  • write a note
  • star tag
  • division mark
  • shutdown tag

As in the following example:

<?php /* Here, I can write what I want */ ?>
<?php echo'My name is Ahmad'; ?>