A Very first version of php is PHP/F1 at 1995 its called Personal Home Page Tools' set of script ,next version of php 2.0 was released at 1997 somewhat more future and several peoples used it, after very short period they released PHP 3(1998) ,Its new version with more function so its called differently compare to PHP2.0 that is recursive acronym – PHP: Hypertext Preprocessor.

After small interval they released PHP4 in 1999 with wide range of additional new features and more no of developers PHP 5 was released in July 2004 after long development PHP is open source general-purpose scripting language with embed In HTML coding ,Its used to develop a dynamic WebPages with added new API packages

Example

First Application

echo "Hi, First PHP script Example. . . . ";
?>

In PHP Scripting Start’s and End’s with

Variable Declaration

In PHP Variables are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive

Example

$Val=’String’;

$Val1=24;

?>

Here variable $val,$val1

Global Variable Declaration

In PHP Global Variable Different from other language, if u can access global variable means you must declare with in the function only

Example

$value=’one’;

function Fn_test()

{

global $value;

$value=’Two’;

}

 

Fn_test();

echo $value;

?>

Here output is Two only ,because in function Fn_test take the global value Two only

Mysql Database Connection in sample coding For PHP

$host=”Localhost”;

$user=”test”;

$pass=”Invdb”;

/* Connecting, selecting database */

$Conn = mysql_connect($host, $user, $pass)

or die("Could not connect");

mysql_select_db("DatabaseName") or die("Check your Database");

/* SQL Operation Here Select, Insert and others */

 

/* Closing connection */

mysql_close($Conn);

?>

 

 


Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments