Learn PHP (Personal Home Page) - Day 2

In my previous blog Learn PHP (Personal Home Page)- Day 1 I told you about the basic concept of PHP. Like- what is PHP, by whom it is developed, when it is developed etc.


1. Programming approaches of PHP
  1. Syntax
  2. Variables
  3. Data types
  4. Operators
  5. Condition statement

    • If-else
    • Nested if – else
    • Else- if
       
  6. Loops
  7. Function

    • Pre-defined
    • User-defined

Syntax /tag - we can define php syntax in four ways.

1. Standard tag

<? php
==== code here ====
?>

2. Short tag

<?
====code here====
?>

3. Asp- style tag

<%
====code here====
%>

4. Script tag

<script language=”php”>
====code here====
<?script>

Note- we can directly use standard tag & script tag, if we are want to use short key tag and asp style tag then we have to make change it in php configuration file. i.e- php.ini

Output statement

Echo “ ”;
Print “ ”;

First php program

<?php
echo “hello this is my first php”;
?>

Save php script page

WAMP -> www -> create new folder-> filename.php
Or
XAMPP -> htdocs -> create new folder -> filename.php

Run the php file

In any browser’s url bar -> localhost -> foldername -> filename.php

2. variables - Variable is a memory location which can hold the value as a temporary basis.

Php variables

  1. Php variables always comes with dolor($) symbol.
  2. Php variables are case sensitive.
  3. Php variable can be defined alpha-numeric but alphabetical term should come first.
  4. We can not use blank space with variable.
  5. All special symbol are not allow as a variable name except _(under score).

Ok friends its too much for today. Next day I comes with a new article “how to install "wamp" or "xampp" in your system".

Next Recommended Reading Login page with PHP