php
DESCRIPTION
presentationTRANSCRIPT
![Page 1: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/1.jpg)
PHP - Hypertext Preprocessor
![Page 2: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/2.jpg)
PHP Hypertext Preprocessor
Introduction History Language syntax Advantages
![Page 3: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/3.jpg)
What is PHP
An established server-side, cross-platform embedded HTML scripting language for creating dynamic Web pages.
PHP provides many features that commercial entities are looking for.
![Page 4: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/4.jpg)
PHP Advantages
• Exceptionally short learning curve • Quick development time • Very high performance • supports all major platforms (UNIX,
Windows and even mainframes).• Features native support for most
popular databases
![Page 5: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/5.jpg)
Intranet Design Magazine
"PHP was built with the needs of Web developers in mind... Unlike other cumbersome, overhead-laden approaches, PHP is lightweight and focused on the Web - where it can solve complex problem scenarios quicker and more easily than comparable technologies."
![Page 6: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/6.jpg)
History of PHP
1994 - PHP was conceived sometimes in the Fall of 1994 by Rasmus Lerdorf
1995 - PHP/FI Version 2. ( Introducing mySql data base)
1997 – approximately 50,000 web sites. Introducing PHP Version 3.(Zeev Suraski and Andi Gutmans )
2000 – PHP 4 was introduced, using “Zend” scripting engine. ( 5.1 million web sites. )
![Page 7: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/7.jpg)
PHP-Enabled Web Pages
Treated just like regular HTML pages and you can create and edit them the same way you normally create regular HTML pages.
As simple as HTML files with a whole new family of magical tags that let you do all sorts of things.
![Page 8: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/8.jpg)
Simple Example:
File name : Hello.php
<html><head><title>PHP Test</title></head><body><?php echo "Hello World<p>"; ?></body></html>
![Page 9: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/9.jpg)
PHP Language
Condition statements, loop statements, arrays ...
Built in libraries. (sorting, list, queue..) Functions. Classes. ( Objects, Inheritance .. ) String Manipulation. ( Perl ) Built in support for encryption/Decryption
functions.( MD5, DES, …)
![Page 10: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/10.jpg)
More on PHP Language:
Text files manipulation. ( Read, write, ..) Supports java objects, COM
objects ... Sessions, cookies …
![Page 11: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/11.jpg)
A More Useful Example • <?php echo $HTTP_USER_AGENT; ?> Mozilla/4.0 (compatible; MSIE 5.01; Windows NT
5.0)
• <?php phpinfo(); ?> A list of all the global variables.
![Page 12: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/12.jpg)
Using if Statements<?phpif(strstr($HTTP_USER_AGENT,"MSIE")) {?><center><b>You are using Internet Explorer</b></center><?} else { ?><center><b>You are not using Internet Explorer</b></center><?} ?>
![Page 13: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/13.jpg)
Dealing with Forms
One of the most powerful features of PHP is the way it handles HTML forms
Any form element in a form will automatically result in a variable with the same name as the element being created on the target page.
![Page 14: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/14.jpg)
FORM Example:• HTML Page:
<form action="action.php" method="post">Your name: <input type="text" name="name">You age: <input type="text" name="age"><input type="submit"></form>
• action.php.Hi <?php echo $name; ?>.You are <?php echo $age; ?> years old.
![Page 15: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/15.jpg)
Database Support
mySQL - PHP and MySQL work very well together, in addition to the speed and features of each individual tool.
PHP is open-source, and offers excellent connectivity to most of today's common databases including Oracle, Sybase, MySQL, ODBC (and others).
PHP also offers integration with various external libraries which enable the developer to do anything from generating PDF documents to parsing XML.
![Page 16: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/16.jpg)
MySQL Example
Connect to MySQL. Send a query. Print a table heading. Print table rows until end of the table
has been reached.
![Page 17: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/17.jpg)
MySQL Example<?php $conn = mysql_connect("localhost", “yaron", ""); $res = mysql_query("SELECT * FROM users", $conn); $header_printed = false; print "<TABLE>\n"; do { $data = mysql_fetch_array($res);
// Retrieve the next row of data.
if (!is_array($data)) { break; }
![Page 18: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/18.jpg)
MySQL Example (continue)if (!$header_printed) { print " <TR>"; reset($data); while (list($name, $value) = each($data)) { print " <TH>$name</TH>\n" } print " </TR>\n"; $header_printed = true; } print " <TR>\n"; print " <TD>";
print implode("</TD>\n <TD>", $data); print " </TR>\n"; } while ($data); print "</TABLE>\n";
?>
![Page 19: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/19.jpg)
Reasons for Using PHP
Speed and robustness. Superior Memory Management No Hidden Costs with PHP Integration with MySQL database. Closer to Java/C++ Style of
Programming. No Show Stopper Bugs. Cross Platform Migration Strategy.
![Page 20: php](https://reader036.vdocuments.mx/reader036/viewer/2022082808/5552d409b4c90532498b45b1/html5/thumbnails/20.jpg)
Where to Find More…
PHP Homepage: http://www.php.net PHP-to-MySQL database tutorial:
http://www.devshed.com/ resource/advanced/php3/intro/index.html
Zend.com: http://www.Zend.com/