what is php php (officially "php: hypertext preprocessor") is a server-side html-embedded...

16
What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language means that code does not need to be compiled before it gets used it gets processed on the fly as necessary has the capability of executing the script on the server and serving the output as a HTML File it is responsible for manipulating the data which is filled in the entire web forms, any where in the net. advantage of interacting with the databases and to perform all types of server manipulations directly

Upload: brittney-stokes

Post on 26-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

What is PHP

• PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language – means that code does not need to be compiled before

it gets used it gets processed on the fly as necessary– has the capability of executing the script on the

server and serving the output as a HTML File– it is responsible for manipulating the data which is

filled in the entire web forms, any where in the net.– advantage of interacting with the databases and to

perform all types of server manipulations directly

Page 2: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

History of PHP

Page 3: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

History of PHP

• PHP/FI (Personal Home Page/Forms Interpreter) is the first release of PHP written by Rasmus Lerdorf in 1995.– It was inititally a simple set of Perl scripts for tracking

accesses to his online resume.

• PHP/FI evolved into PHP 1.0 and 2.0, advanced piece of software that understood complex scripts.– Php 2.0 was released in 1997 and it had around

50,000 domains in which it was installed in.

Page 4: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

History (cont’n)

• PHP 3.0 was created by Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite of the original PHP/FI 2.0. – was the first version that closely resembles PHP as

we know it today.• PHP 3.0 had strong extensibility features, with

solid infrastruscture for lots of databases and API’s. – It attracted dozens of developers to join in and submit

new existing modules.– by the end of 1998 it was installed on hundreds of

thousands of websites.

Page 5: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

History (cont)

• PHP 4.0 officially released may 2000.

-based on the ZEND engine, a rewrite of PHP’s core to achieve improved performance of complex applications, and improve modularity of PHP’s code base

- May 2003, almost 13 million domains were using PHP according to Netcraft survey and PHP.nets figures

Page 6: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Features

• PHP has support for most of the web servers today. – Apache, Microsoft IIS, PWS, Netscape and iPlanet servers,

Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others.

• PHP has support for a wide range of databases– Adabas D, Ingres, Oracle (OCI7 and OCI8), dBase, InterBase, Ovrimos,

Empress, FrontBase, FilePro (read-only), mSQL,Solid, Hyperwave, Direct MS-SQL, Sybase, IBM DB2, MySQL, Velocis, Informix, ODBC, Unix dbm

Page 7: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Features

• You can very rapidly develop web applications in PHP

• PHP applications are very stable and do not depend on the browser technologies

Page 8: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Features

• Dynamically typed language, so it makes it extremely easy and fast to develop in.

• PHP has Zend optimizer which speeds up the performance

• PHP has a very large user base and developer base

Open Source - PHP is open source, you can modify the

actual language to your needs.

Page 9: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Disadvantages

• Primitive Error Handling • It is a Dynamically typed language, so it makes it

extremely easy to hang yourself if you don't know what you are doing

• Some of the function names do not have a consistent naming scheme.

• Object orientation is really syntatic sugar. Objects are only slightly more than assoicative arrays with functions bound to them.

• Lacks Database Abstraction

Page 10: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Sample Programs

Page 11: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Example1

• A basic PHP script:

<?php

echo "Hello World!";

?>

Page 12: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Example 2text.html <FORM METHOD =

POSTACTION="text.php"> Who is your favorite author?<INPUT AME="Author"TYPE="TEXT"><INPUT TYPE=SUBMIT>

</FORM>

text.php <?php

echo "Your favorite author is: $Author";?>

Page 13: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Example 3Number.html

<FORM METHOD=GET ACTION ="number.php"> I would like to know: <BR>

<INPUT NAME ="opt1" TYPE = "Radio" Value="fact"> the factorial of <BR><INPUT NAME ="opt1" TYPE = "Radio" Value="prime"> if the following number is prime <BR> <INPUT NAME ="opt1" TYPE = "Radio" Value="next">the number following <BR> <INPUT NAME =

"Value" TYPE="Text"><BR><INPUT TYPE = SUBMIT> </FORM>

Page 14: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Example 3 con’tnumber.php <?phpfunction fact($Value){

if($Value<=1) return 1;elsereturn

$Value*fact($Value-1); }function isPrime($Value) {

$Count = 2;do{$Remainder = $Value%$Count;$Count++;}while ($Remainder !=0 AND $Count<$Value);if(($Count<$Value) OR ($Value == 0)){

echo "$Value is not prime";}else{

echo "$Value is prime";}

}

switch($opt1){ case "fact":

echo "$Value has a factorial of" . fact($Value);break;

case "prime": echo isPrime($Value);break;

case "next": echo "The next number after

$Value is " . ($Value+1); break;

} ?>

Page 15: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled
Page 16: What is PHP PHP (officially "PHP: Hypertext Preprocessor") is a server-side HTML-embedded scripting language –means that code does not need to be compiled

Links

• php manual: http://www.php.net/docs.php• compiler url http://www.php.net/downloads.php

• http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/phpvsaspnet.asp (asp vs Php)

• http://www.zend.com/