Learn PHP Basics Part 1-Definition & Details

Sharing is Caring
Share

If you are looking to learn php, then I am creating this php basics tutorial which could help you in understanding the php. This tutorial is targeted towards people with no to little technical backgrounds and beginners.

In this tutorial, we will use simple examples. This php learning course will be progressive in nature and as we will move ahead, we will take on advance aspects also. But for the time being, we will walk through php basics.

PHP Definition

PHP is a server side scripting language which is widely used in current world. Most of the website you visit today are formed using php including this one and sites like wordpress.

PHP is a loosely typed programming language and very efficient. It is easy to learn and understand.

As mentioned earlier, PHP is a server side language which means that when you visit a site in your web browser, request is sent to the server. Then server processes the php code and return the value to the browser. So if you right click and click on source of any webpage, you will html and not php in it.

php definition

So if you want to learn php, then it will be better to install a server which can understand and process php. Basically you need to setup development environment. Now don’t worry you don’t need to put any money to do that, just install xampp for windows or MAMP for Mac.

To know more about how to install Xampp, click here.

Above post is geared more towards installing wordpress on xampp but the steps remain same for installing and verifying xampp on windows. If you have any doubt, you can leave your question here.

Basically it will set up a development environment on your computer with all the necessary components like apache server, database and other components of it.

After installing, you just have to use htdocs folder/directory inside XAMPP.

If you have already visited above given link, then your installation is ready and you can try your hands on php.

So let write a basic php to understand it;

<?php
echo “My first PHP code!”;
?>

php basics learning

To write it, you can use php editor like editra or notepad++. I have used dreamweaver which is a paid product in this screenshot but don’t bother, you can achieve same result using free editra and notepad++.

I haven’t mentioned about php editors in earlier part. You can use something Microsoft word to write php as they add lot of code intrinsic to them, therefore you have to use some php editors to write php or other programming language.

Most of these php editors are free, I have used notepad++ and editra.

So after writing above code in your editor, save the file with the extension .php.

This is the first step in learning php, all php files should be saved with .php extension.

Save this file in htdocs folder of your XAMPP installation. Then open that file using chrome or IE or any other web browser.

Understanding PHP

First line – <?, every php code must start with these two signs, it tells server that php code starts here.

Second line- echo “My first PHP Code”;

Echo is the command which tells browser to output the text enclosed in “”. These double inverted comas inform browser on where the code start and ends. All php statement must end with semicolon.

Third line-?>, php code begins with the first line mentioned above, all php code ends with a ? followed by >.

PHP Basic Part 1 Conclusion

In this php basic part 1, we have learned the definition of php, installed a development region and the basic of php code.

In next part of php basics, we will have a much deeper look in the various aspects of php.

We are going to take it step by step so that it doesn’t become overwhelming and easy to learn. In the meantime, play with code given above and install your system.

Sharing is Caring
Share
About akhilendra

Hi, I’m Akhilendra and I write about Business Analysis, Data Science, IT & Web. Join me on Twitter, Facebook & Google+

Speak Your Mind

*