Showing posts with label php tutorial. Show all posts
Showing posts with label php tutorial. Show all posts

Sunday, 6 July 2014

PHP Variables

In general term

" A variable is a character or symbol that represents a certain value."

Suppose

A = 5
B = 2

Here
A and B are two variables
Variable A holds value 5
Variable B holds value 2

Types of PHP Variables

 Most common types of variables are given below.
  1. Local variables
  2. Global variables
  3. Static variables
  4. Function parameters

Tuesday, 30 July 2013

Example of HTML PHP Comment

Type the following code in your text editor..

<HTML>
<HEAD>
<TITLE>Example of Comments</TITLE>
</HEAD>
<BODY>
<!-- html comment style -->

<?
// This is a single line PHP comment style.

# Shell type comment style.
/* This is a C style comment, we can use it for multiple lines 

this is suitable for multiple line comment */
?>

</BODY>
</HTML>


Now save this file as comment.php

Comment in PHP

Various types of syntax are used  to add comment in PHP.

Syntax 1

// this is single line comment in php code.

Syntax 2

# this is another style of comment in php code called shell-style.

Syntax 3


/* this is C-style comment in php code used for upto two lines */

Syntax 4

<!   example of html comment which is ignored by browser  >

Saturday, 27 July 2013

PHP Start and End tags

There are three basic types of PHP Start and End tags which is also called PHP Opening and Closing tags respectively.


Figure: PHP Starting and Ending Tags


Examples:

You can use any type of php tag in your script.

<?
echo "<P>Example of 1st type of PHP tag.</P>";
?>


<?php
echo "<P>Example of 2nd type of PHP tag.</P>";
?>


<script language="php">
echo "<P>Example of 3rd type of PHP tag.</P>";
</script>