Professional Documents
Culture Documents
Preprocessor
Yaron Benita
De Paul University
PHP
l Introduction
l History
l Language syntax
l Advantages
What is PHP
• action.php.
Hi < ? p h p e c h o $ n a m e ; ? > .
Y o u a r e < ? p h p e c h o $ a g e ; ? > years old.
Database Support
l mySQL - PHP and MySQL work very well
together, in addition to the speed and
features of each individual tool.
l PHP is open-source, and offers
excellent connectivity to most of today's
common databases including Oracle,
Sybase, MySQL, ODBC (and others).
l PHP also offers integration with various
external libraries which enable the
developer to do anything from
generating PDF documents to parsing
XML.
MySQL Example
l Connect to MySQL.
l Send a query.
l Print a table heading.
l Print table rows until end of the
table has been reached.
MySQL Example
<?php
if (!is_array($data)) {
break;
}
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>";
?>
Reasons for Using PHP
l Speed and robustness.
l Superior Memory Management
l No Hidden Costs with PHP
l Integration with MySQL database.
l Closer to Java/C++ Style of
Programming.
l No Show Stopper Bugs.
l Cross Platform Migration Strategy.
Where to Find More…
l PHP Homepage: http://www.php.net
l PHP-to-MySQL database tutorial:
http://www.devshed.com/
resource/advanced/php3/intro/index
.html
l Zend.com: http://www.Zend.com/