Introduction To PHP

What is PHP(Hypertext Preprocessor)?

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.

It is Competitor of Microsoft’s ASP.

And It is the core of “WordPress”.

and yes it is Open Source language.

basically scripts are executed on server.


How to work with PHP?

We will be scripting with the help of “WampServer“.

so first step is to install wamp on your computer.Not going to describe how to install. This you should know 🙂 .


First PHP Script.

You should have knowledge of HTML , CSS and JAVASCRIPT. But if you don’t have.No worries we will help you in each step!.

So, After you installed wamp on your drive go to the www folder and then open text editor (like notepad) and paste the code as below:

<!DOCTYPE html>
<html>
<body>

<?php
echo “<p>My first PHP script!</p>”;
?>

</body>
</html>

Now save it with .php file and open in your browser.

with http://localhost/yourfilename.php 

So, basically this runs on your local server and return you as a plain HTML. you can see that with “view page source” in your browser

you can not open .php file directly to your browser it will not understand echo and all other syntax.


Wait what is <? and ?> .

A PHP script starts with <?php and ends with ?>


Ok now Echo.

Echo basically print the statement written within ” “ and remember statements ends with ; (semicolon).

Advertisements

Author: kanu_lp

Teck Geek guy... Bands Obsessed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s