PHP Hypertext Preprocessor Basics

What is PHP?

PHP means Hypertext Preprocessor and is a server-side scripting language but is also used as a programming language. PHP is often used with HTML. An HTML Page is static and PHP can make the webpage dynamic.

How to use PHP

What do I need to write PHP and test it?

First thing you will need is a good text editor there are many different kinds of text editor on the market. I like using Dreamweaver but I think Netbeans or Notepad++ is good free alternative, but there is a lot of different options so you should take some time to pick an editor there fit your need’s.

Second, you need to simulate a server if you don’t have and domain and online web server. I am using MAMP just the free version and I think it works fine but I don’t know if there are any better alternatives

I also made a short guide on how to install and use MAMP 

How do i write PHP?

To Write PHP you need to write <?php                    ?>  inside a php file, if you have a .html file you need to change it to .php instead.


<?php echo “this is php”; ?> this will output the text this is php.

<?php echo 5+5; ?> this will ad 5 + 5 and print out the result on screen which is 10

It can be a good idea to apply comments to your PHP code you can do this like this, so you and others who look at your code in the future can see why you have coded it that way.

/* This is a PHP comment remember to close the comment again