PHP Tutorial

What is PHP?

PHP, which is recursive acronyms for “PHP Hypertext Preprocessor”, is a server-side, HTML embedded scripting language used to create dynamic Web pages. Much of its syntax is borrowed from C, Java and Perl with some unique features thrown in. The goal of the language is to allow Web developers to write dynamically generated pages quickly. …

What is PHP? Read More »

Why PHP?

Why PHP? it’s no secret that there are alternatives to PHP: ASP, JSP, Cold Fusion, and Perl, to name just a few. While each of these languages has differences in syntax and structure, when it comes down to it, they can all produce the same results. So, why would you choose PHP over other options? …

Why PHP? Read More »

Where do PHP Stands?

No doubt much of its popularity is due to its relative ease to learn, and its notorious looseness. Arrays and variables in PHP are able to hold any type of object, variables need not be declared, and the syntax is remarkably simple.   Unlike many languages, such as C# or Perl, which have primarily a …

Where do PHP Stands? Read More »

Pre-requisite In PHP

If you choose PHP as your development language, what you need to get started depends on:   • Sound knowledge of HTML. *   • Working knowledge of JavaScript(optional, but strongly recommended) **   • Sound Knowledge of SQL and knowledge of any RDBMS software (MySQL recommended)***   • Access to a web server that …

Pre-requisite In PHP Read More »

Choosing an Editor In PHP

On Linux   Bluefish – Supports any protocol that is supported by GNOME VFS. (FTP, SSH…)   gedit – gedit is a free software, UTF-8 compatible text editor for the GNOME desktop environment. It is designed to have a clean, simple interface inspired by the ideals of the GNOME project.   gPHPEdit– gPHPedit is a …

Choosing an Editor In PHP Read More »

Testing your Environment In PHP

While there’s nothing wrong with getting started writing PHP scripts sing no-frills editors such as Windows Notepad or vi, chances are you’re soon going to want to graduate to a full-fledged PHP-specific development solution. Several open source and commercial solutions are available. The best way to verify your PHP installation is by attempting to execute …

Testing your Environment In PHP Read More »

First PHP script

First PHP script Every language has it… First PHP script the basic “Hello, World!” script. It is a simple script that only displays the words“Hello, World!”. Over the years this has become the traditional phrase to use when writing your first program.   According to Wikipedia, it’s mainstream usage spawned from an internal memorandum in …

First PHP script Read More »

PHP Syntax

PHP Syntax You cannot view the PHP source code by selecting “View source” in the browser – you will only see the output from the PHP file, which is plain HTML. This is because the scripts are executed on the server before the result is sent back to the browser.   Now that you are …

PHP Syntax Read More »

PHP comments

When programming in any language the process of adding comments involves writing notes alongside the code to describe what the code does and how it works. The comments are ignored by the PHP pre-processor when executing a script and are purely for human consumption.In Short Comments are used as a note of the code for …

PHP comments Read More »

PHP Operators

There are three types of operators. Firstly there is the unary operator which operates on only one value, for example ! (the negation operator) or ++ (the increment operator). The second group are termed binary operators; this group contains most of the operators that PHP supports.The third group is the ternary operator: ?:. It should …

PHP Operators Read More »

PHP Execution Operator

All of the operators we have looked at so far are similar to those available in other programming and scripting languages. With the execution operator, however, we begin to experience the power of PHP as server side scripting environment. The execution operator allows us to execute a command on the operating system that hosts your …

PHP Execution Operator Read More »

PHP Variables

Variables are used for storing values, such as numbers or strings , so that they can be used many times in a script.   A large part of writing scripts, and programming, involves the handling and manipulation of data. Data have forms, ranging from single characters, words and sentences to integers, floating point numbers and …

PHP Variables Read More »

PHP String

A string variable is used to store and manipulate a piece of text.   Working with Strings   String variables are used for values that contains character strings. In this tutorial we are going to look at some of the most common functions and operators used to manipulate strings in PHP. After we create a …

PHP String Read More »

PHP Arrays

An array is a data structure that stores one or more values in a single value. For experienced programmers it is important to note that PHP’s arrays are actually maps (each key is mapped to a value).   PHP Arrays provide a way to group together many variables such that they can be referenced and …

PHP Arrays Read More »

IF-ELSE In PHP

The PHP If Statement   The if statement is necessary for most programming, thus it is important in PHP. Imagine that on January 1st you want to print out “Happy New Year!” at the top of your personal web page. With the use of PHP if statements you could have this process automated, months in …

IF-ELSE In PHP Read More »

Switch case In PHP

The Switch case In PHP is used to perform one of several different actions based on one of several different conditions. SWITCH is used in PHP to replace nested IF..ELSE loops, and is similar to the CASE command in other computer languages.   With the use of the switch statement you can check for all these …

Switch case In PHP Read More »

What is PHP Loops ?

It is generally accepted that computers are great at performing repetitive tasks an infinite number of times, and doing so very quickly. It is also common knowledge that computers really don’t do anything unless someone programs them to tell them what to do.   Loop statements are the primary mechanism for telling a computer to …

What is PHP Loops ? Read More »

PHP Functions

In the world of programming and scripting there are two ways to write code. One way is to write long, sprawling and monolithic sections of script. Another is to break the scripts up into tidy, self contained modules that can be re-used without having to re-invent the same code over and over again.   Obviously …

PHP Functions Read More »

Creating Databases and Tables In PHP

Creating Databases   PHP Script to create database   <?php class dbUtils{ private $flag; private $sql;//=”create database “; private $msg;//=””;*/ #function createDB public function __construct(){ $this->flag=0; $this->sql=””; $this->msg=””; } public function connect(){ $con=@mysql_connect(“localhost”,”root”,””); if(!$con) return NULL; else return $con; } function createDB($db_to_create) { $msg=””; $flag=$this->flag; if((!$db_to_create)|| ($db_to_create==””)) $flag=-1; if(isset($_POST[“submit”])&& ($flag >=0)){ $sql=”create database “.$db_to_create; $con=$this->connect(); …

Creating Databases and Tables In PHP Read More »