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 - Syntax
- Variables
- Data types
- Operators
- Condition statement
- If-else
- Nested if – else
- Else- if
- Loops
- Function
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
- Php variables always comes with dolor($) symbol.
- Php variables are case sensitive.
- Php variable can be defined alpha-numeric but alphabetical term should come first.
- We can not use blank space with variable.
- 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".