Introduction to PHP

free php tutorials, php classes, php utilities, free tools What is PHP?
  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a server-side scripting language, like ASP, Coldfusion, Perl
  • PHP is a programming language was designed for creating dynamic websites
  • PHP supports many databases like MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.
  • PHP is an open source software and you can download free from www.php.net.
  • PHP is easy to learn and runs efficiently on the server side
  • PHP runs on different platforms like Windows, Linux, Unix, etc.
  • PHP is compatible with almost all servers used today like Apache, IIS, etc.

What is an PHP File?
An PHP file is a text file that contains HTML, XML Tags, Text and scripts. The scripts in PHP files are excuted on the server. The file extension of PHP file is ".php".

PHP Requirements

PHP Tags

PHP has following tags:

Start Tag End Tag
<?php ?>
<script language="php"> </script>
<? ?>
<% %>

First PHP Script 

For write first script of PHP, Open notepad. Type the below example and save the file at C:\apache\htdocs\filename.php,

<?php
print "Hello World!";
?>

In this script <?php is used for start PHP tag.

print is used to print any statement on page. Another function echo is also to print any statement on page.

semicolon (;) is used for end any statement .

?> is used for end php script

 

Comments in PHP

Comments are used for ignore any statements.There are two comment tags used in PHP.

// (Single Line Comments ) will comment out a single line of coding.

<?php
// print some text
print "my first PHP script!";
?>

/* */ (Multiple Line Comments ) will comment out a block of code.

<?php
/*
print some text
this is a comment
over more than one line
*/
print "my first PHP script!";
?>

Bookmark This Page