Evolution of PHP PHP was created by Rasmus
Evolution of PHP • PHP was created by Rasmus Lerdorf in 1994. It was initially server-side, traffic tracking script. • PHP 2 (1995) Added database support, file uploads, regular expressions, etc. • PHP 3 (1998) Zeev Suraski and Andi Gutmans transform PHP and re-engineered the parser.
• PHP 4 (2000): The parser was dubbed the Zend Engine, and many security features were added. • PHP 5 (2004): Zend Engine II, support for object oriented programming, robust XML support, Web Service interoperability, SQLite
Why Use PHP 1. Easy to Use Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". <html> <head> <title>Example</title> </head> <body> <? php echo "Hi, I'm a PHP script!"; ? > </body> </html>
Why Use PHP 2. Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on libraries for PHP that are also free. PHP Software Free Platform Free (Linux) Development Tools Free PHP Coder, j. Edit
Why Use PHP 3. Cross Platform Web Servers: Apache, Microsoft IIS, Caudium, Netscape Enterprise Server Operating Systems: UNIX (HP-UX, Open. BSD, Solaris, Linux), Mac OSX, Windows Supported Databases: Adabas D, d. Base, Empress, File. Pro (read-only), Hyperwave, IBM DB 2, Informix, Ingres, Inter. Base, Front. Base, m. SQL, Direct MSSQL, My. SQL, ODBC, Oracle (OCI 7 and OCI 8), Ovrimos, Postgre. SQL, SQLite, Solid, Sybase, Velocis, Unix dbm
Data Types Category Data Type Attributes Primitive Integer Bases: 8, 10, 16 Primitive Floating Point Used for doubles Primitive String “I hate Public Speaking!” Primitive Boolean true, false—can convert to 0, 1 Compound Object Access by Reference (default) Compound Array Ordered Map
Explicit Type Conversion settype() function $test. String = “ 9. 0”; settype($test. String, “integer”); Casting $some. Data = 1; (String) $some. Data; (double)$some. Data; http: //www. phpjunkyard. com/download. php? script=tcount
Control Structures Conditional Iterative for() If…elseif foreach() Switch while() do…while
Exception Handling v. Exceptions handling is facilitated courtesy of the Exception Class Example Exception Handling in PHP: function check. Num($number) { if($number>1) { throw new Exception("Value must be 1 or below"); } return true; } try { check. Num(2); } catch(Exception $e) { echo 'Message: '. $e->get. Message(); }
Sources • “PHP Manual”. http: //www. php. net/manual/en/index. php (This is the site for the official manual of the PHP language) • Peter L. Kantor. “Hudson Valley Community College Web Site”. http: //www. daaq. net/old/php/index. php • Sebesta Robert W. Concepts OF Programming Languages. Tenth Edition. Boston: Pearson, 2010 • Wellington, Luke Thomson, Laura. PHP and My. SQL Web Development. Second Edition. Developers Library. USA. Sams Publishing. 2003 • Harris, Andy. PHP 5/My. SQL Programming. for the absolute beginner. Canada. Premier • Gilmore, Jason. Beginning PHP and My. SQL: From Novice to Professional. Fourth Edition. Apress. 2010 • Habib, Irfan. “Integrating PHP and Perl”. Linux Journal. Volume 2007 Issue 154. Feb 2007 • Fioretti, Marco. “Top Ten Tips for Getting Started with PHP”. Linux Journal. Volume 2006 Issue 145. May 2006 • Knudsen, Craig. “PHP Version 4”. Linux Journal. Volume 1999 Issue 67 es. November 1999 http: //pecl. php. net/package/operator
- Slides: 12