• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
PHP: The Beginning and the Zend
 

PHP: The Beginning and the Zend

on

  • 1,754 views

An introduction to PHP, covering topics from history of the platform and personalities involved, to strengths/weaknesses of the language and how to best use it. ...

An introduction to PHP, covering topics from history of the platform and personalities involved, to strengths/weaknesses of the language and how to best use it.

Available under the Creative Commons Attribution Share-Alike Non-Commercial Unported 3.0 license.

Statistics

Views

Total Views
1,754
Views on SlideShare
1,754
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Rasmus Lerdorf also has Canadian citizenship.
  • Andi Gutmans is of Swiss descent
  • What happens when your graphics people help with the back-end.

PHP: The Beginning and the Zend PHP: The Beginning and the Zend Presentation Transcript

  • PHP: The Beginning and the Zend Presentation by Jonathan Hawk. Available under the Creative Commons Attribution Share-Alike Non-Commercial license.
  • History
    • 1994 – Started development
    • 1995-06-08 – PHP/FI
    • 1997-11-01 – PHP/FI 2
    • 1998-06-06 – PHP 3
    • 2000-05-22 – PHP 4 (powered by Zend Engine)
    • 2001-12-10 – PHP 4.1 (superglobals)
    • 2002-12-27 – PHP 4.3 (CLI)
    • 2004-07-13 – PHP 5 (powered by Zend Engine II)
    • 2009-06-30 – PHP 5.3 (namespaces, closures)
    http://upload.wikimedia.org/wikipedia/commons/a/ac/RasmuswJGang.jpg (public domain) Rasmus Lerdorf Joomla! Developers
  • Rasmus Lerdorf
    • Twitter: @rasmus
    https://secure.wikimedia.org/wikipedia/commons/wiki/File:Rasmus_Lerdorf_cropped.jpg (CC-BY-SA)
  • http://www.flickr.com/photos/isthmene/4370546993 (CC-BY-NC)
  • Andi Gutmans & Zeev Suraski
    • Twitter: @andigutmans/ @zeevs
    https://secure.wikimedia.org/wikipedia/commons/wiki/File:Andi_Gutmans_1.jpg (CC-BY) https://secure.wikimedia.org/wikipedia/commons/wiki/File:Zeev_Suraski_2005_cropped.jpg (CC-BY-SA)
  • http://www.flickr.com/photos/heyskinny/549085823 (CC-BY-NC)
  • Use: When?
    • Web sites and Web applications
      • Easy to learn* – finally your web designers can help with the back end!**
        • * = also easy to screw up
        • ** = web designers should not help you with the back end
    • CLI scripts
    • GUI applications (PHP-GTK)
    • Available on Linux, Unix, Windows , Mac OS X, AS/400, Novell NetWare, OS/2, RISC OS, SGI IRIX 6.5.x, Solaris (SPARC, INTEL), Solaris OpenCSW packages
  • http://flickr.com/photos/sister_ray/3461372416 (CC-BY-NC)
  • Use: Good Company
  • Use: Software
    • Most widely-used forums (phpBB, vBulletin)
    • Most widely-used CMSs (Drupal, Joomla!, ezPublish)
    • Most widely-used blogs (WordPress, Typo3, Serendipity)
    • Most widely-used wikis (MediaWiki, DokuWiki)
    • Most web-based e-mail (SquirrelMail, Roundcube, Kerio, Horde IMP)
  • Use: Web Slinger
    • PHP was made for web sites
      • Web server module (ISAPI)
        • Runs in same memory space as web server
      • Fast-CGI
      • CGI
    • Widely adopted – most web hosting includes PHP and MySQL
  • Use: Tag Soup
  • Language: PHP in One Sentence "What if C and Perl had a love child that Java babysat from time to time?"
  • Language: Borrowed
    • From Perl:
      • String usage, type system, variable syntax, operators
      • PHP arrays appear to be a combination of Perl arrays and hashes
    • From C: (PHP is written in C, by the way)
      • Function names
      • Pass-by-reference syntax
    • From Java:
      • Class syntax, interfaces, exceptions
  • Language: Features
    • Dynamically and weakly typed
    • Interpreted
      • Speed through bytecode caches
    • Reflective
      • Types, Names
    • Both procedural and Object-oriented
    • Clone any object, serialize any object
    • Objects passed by reference
    • Arrays and primitives passed by value
  • Language: Typing
    • Dynamic
      • Variable types unnecessary, same variable can hold different types
    • Weak
      • 0 == 0.0 == false == null == "" == array()
      • 1 == 1.0 == true == "!empty" == array('!empty') == $object
      • Methods expecting one type will convert from others
        • "1234" will be converted to 1234.
        • "foobar" will be converted to 0.
  • Language: Classes
    • Namespaces
    • Public/protected/private members
    • Superclasses and interfaces
    • Abstract and final classes
    • Constructors and destructors
  • Language: Class Example
  • Language: Methods
    • Abstract, static, and final
    • Arguments
      • Optionally type-hinted
      • "Overloading"
    • No return types
  • Language: Methods Example
  • Language: Docblocks
    • Docblocks often necessary for IDE code completion
  • http://www.flickr.com/photos/thebigdurian/374229490 (CC-BY-NC-SA) Strengths
  • Strengths
    • Anonymous functions/closures
    • Variable method names
    • Magic methods
    • Arrays
    • Database connectivity
    • Date operations
    • Perl-Compatible Regular Expressions
    • Web-related stuff: file uploads, tag stripping, etc
  • Strengths: Closures
  • Strengths: Dynamic invocations
  • Strengths: Magic Methods
  • Strengths: Arrays
  • Strengths: Database Connectivity
    • CUBRID *
    • dBase
    • DB++
    • FrontBase
    • filePro
    • Firebird/InterBase *
    • Informix *
    • IBM DB2 (Plus Cloudscape and Apache Derby) *
    • Ingres
    • MaxDB
    • Mongo
    • ODBC *
    • mSQL
    • Microsoft SQL Server *
    • MySQL/Mysqli/Mysqlnd *
    • Oracle OCI8 *
    • Ovrimos SQL
    • Paradox
    • PostgreSQL *
    • SQLite/SQLite3 *
    • Sybase *
    • tokyo_tyrant
    Bold = Built-in at compile time. * = PDO Driver available.
  • Strengths: Date Operations
    • strtotime — Parses almost any date format
      • "+1 year"
      • "-3 weeks"
      • "Last wednesday"
      • "Tomorrow 6:12pm"
      • "2010-01-12T12:21:12+0500"
      • "Wed, Mar 2, 2011 3:00 pm"
    • "date" — displays dates
  • Strengths: PCRE
  • Strengths: Web stuff
    • Superglobals: $_GET, $_POST, $_COOKIE, $_SESSION, $_FILE, $_SERVER, $_ENV
    • htmlspecialchars(), htmlentities(), strip_tags(), nl2br()
    • header(), setcookie()
  • http://www.flickr.com/photos/thetrouseredape/3267689296 (CC-BY-NC-SA) Weaknesses
  • Weaknesses: Language
    • Inconsistent API
      • in_array($needle, $haystack)
      • strpos($haystack, $needle)
    • Unicode support*
    • Errors and Exceptions*
    • Extensions are hit-or-miss
  • Weaknesses: Scaling/Speed
    • Overhead with single-request scope
      • Move session storage to memory
      • In-memory cache (Memcached/APC)
      • Database
      • Clustered software (Zend Platform, etc.)
    • Bytecode caching (APC, Xcache, etc.)
  • Weaknesses: Thread Safety
    • Linux/Unix
      • FastCGI
      • Non-thread safe
    • Windows
      • Most Windows libraries PHP uses are thread-safe
      • Recommends FastCGI, anyway
  • PHP Personalities Andrei Zmievski (@a) PHP Core, PHP-GTK, Smarty Wez Furlong (@wezfurlong) PHP Core, PDO, PECL extensions Sebastian Bergmann (@s_bergmann) PHPUnit Derick Rethans (@derickr) PECL extensions, Xdebug Ilia Alshanetsky (@iliaa) PHP Core Matthew Weier O'Phinney (@weierophinney) Zend Framework
  • Where do you go?
    • http://php.net
    • http://devzone.zend.com
    • http://www.planet-php.net
    • http://www.phparch.com