PHP CSCE 330 February 6, 2003 Group Members: Antwan B. Phan George Hwang Luat Vu Programming Language Presentation
I.What is PHP? II.What does it do? III.How does it work? IV.Comparison of languages V.Advantages and Disadvantages VI.Samples of Code VII.Conclusion VIII.References & Resources Contents
What is PHP? PHP stands for Personal Home Pages Hypertext Processor. PHP is a server-side, cross-platform, HTML embedded scripting language. Was designed in 1995 by Rasmus Lerdorf because it needs a free tools to program Web pages.
What is PHP? A fast, powerful and mature web-based server-side programming language. Allows the creation of dynamic web pages for powerful web sites and web based applications.
What does it do? An Internet tool. It is usable for processing large data on server-side and build an html page that display the results. Allows tight integration with a number of database systems including including Informix, Microsoft SQL Server, mSQL, MySQL, ODBC, Oracle and Sybase Used in conjunction with a relational database system, like MySQL, large sets of data can be handled with speed and flexibility.
How does it work? A PHP scripts produces web pages, and may be embedded inside html code. Combines elements of functional and imperative languages Interpreter: take source code and directly execute it. Compiler: convert source code into executable code that can be run at a later time
How does it work? Similar to C, but adds dynamic variables. Serves as a "wrapper" for many standard C libraries. A server must be configured to execute the interpreter on pages with.php extensions, and send resulting html pages on the network.
Comparison of Languages PHP draws its strengths from a highly flexible language derived from C/C++ and its predecessor, PERL. Perl syntax is very different from PHP, which is more formal with its C influenced procedure-based syntax. In comparison with Perl, PHP gains some on the readability side, but loses a lot on the convenience side.
Advantages PHP is a powerful language providing fast development time. There is a large amount of Open Source code written in PHP meaning affordable and speedy development of new applications. Since it uses similar syntax and constructs, knowledge of PHP can help you in learning the C language.
Disadvantages In order for a database to run correctly, the PHP code must be changed to suit the desired database. A disadvantage is actually created by writers of PHP scripts who inadvertently create a bug through which hackers can exploit. Cookies don't work.
Samples of Code Example Start Tag: :End Tag
Samples of Code Code to Open and Query a database in PHP <?php $sql = "SELECT * FROM queryitems"; //creates variable ($sql), sets equal to string mysql_connect(); //connects to MySQL engine $rs = mysql_db_query("Websitedb",$sql); //creates record set which contains the results of the //query ?>
Conclusion PHP is a server-side scripting language that facilitates the creation of dynamic Web pages by embedding PHP-coded logic in HTML documents. PHP can easily be self-taught and easily be programmed for everyday use. PHP combines many of the finest features of Perl, C, and Java, and adds its own elements to the concoction to give Web programmers great flexibility and power in designing and implementing dynamic, content-oriented Web pages.
References & Resources p p