140 likes | 409 Views
PHP: Hypertext Preprocessor. Jordan Davenport. Brief History. Created in 1994 by Rasmus Lerdorf Released June 1995 as "Personal Homepage Tools" Rewritten a few times, carried different names. Rasmus Lerdorf. Image Source: http://lerdorf.com/bio.php. ...Not So Brief History!.
E N D
PHP: Hypertext Preprocessor Jordan Davenport
Brief History • Created in 1994 by RasmusLerdorf • Released June 1995 as "Personal Homepage Tools" • Rewritten a few times, carried different names • Rasmus Lerdorf Image Source: http://lerdorf.com/bio.php
...Not So Brief History! • Rewritten in 1997 by AndiGutman and ZeevSuraski • Rewrite became PHP 3.0 • Officially replaced PHP/FI 2.0 in 1998 • Multi-Platform • PHP Development Team • Current Stable Release: 5.3.8 • Release Candidate: 5.4.0RC2 on Thanksgiving
Data Typing Weakly Typed Four Scalar Types: • Boolean • Integer • Float • String Compound Types: • Array • Object Special Types: • Resource • NULL
Functions & Variables • Variables prefixed with $ • Alphanumeric with underscores • Must start with letter or _ • Global scope isolated from local • Variable Functions
Expressions, Statements, & Control • C-like syntax and operators • String concatenation: . and .= • No integer division! • if, if...else, if...elseif...else, switch • while, do...while, for, foreach
Abstraction & OOP • Class-based OOP • Variables are "Properties" • Properties must be declared public/protected/private • Functions default public • -> instead of "dotting in" to access members (like C++ pointers)
Paamayim Nekudotayim • Scope resolution operator :: • Access class members without instantiation • <class_name>::<member> • self::foo($bar) • Confuses users:http://phpsadness.com/sad/1 פעמיים נקודתיים
Exception! try { code block here } catch { another block here } • Uncaught exceptions cause "Fatal Error" • set_exception_handler() for what isn't caught
Evaluation Time • Readability • Overloading? Pft! • Lacks data type declarations • Writability • Syntax to suit your needs • Reliability • Different integers, floats on different systems • Cost • FOSS but GPL-incompatible • Inconsistent documentation
Examples http://www.caitsith2.com/ds/fc.php http://kurtis.voidaudio.net/phpbb_news.php http://kurtis.voidaudio.net/test.php
References • Phalanger: The PHP Language Compiler for the .NET Framework. 26 September 2011. 26 September 2011. <http://phalanger.codeplex.com/>. • "PHP." 20 September 2011. Wikipedia, The Free Encyclopedia. 26 September 2011. <http://en.wikipedia.org/wiki/PHP>. • "PHP Tutorial." n.d. W3Schools Online Web Tutorials. 26 September 2011. <http://www.w3schools.com/php/default.asp>. • PHP: Hypertext Preprocessor. n.d. 26 September 2011. <http://www.php.net/>. • "PHP: License Information." 10 2011. PHP: Hypertext Preprocessor. 20 10 20011. <http://php.net/license/index.php>. • Sebesta, Robert W. Concepts of Programming Languages, Ninth Edition. Boston, MA: Pearson Education, Inc., 2010.