php: the beginning and the zend

Download PHP: The Beginning and the Zend

If you can't read please download the document

Upload: doublecompile

Post on 16-Apr-2017

2.440 views

Category:

Technology


0 download

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)

Rasmus Lerdorf also has Canadian citizenship.

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)

Andi Gutmans is of Swiss descent

Use: When?

Web sites and Web applicationsEasy 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)

What happens when your graphics people help with the back-end.

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 sitesWeb 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

InterpretedSpeed through bytecode caches

ReflectiveTypes, Names

Both procedural and Object-oriented

Clone any object, serialize any object

Objects passed by reference

Arrays and primitives passed by value

Language: Typing

DynamicVariable types unnecessary, same variable can hold different types

Weak0 == 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

ArgumentsOptionally 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 APIin_array($needle, $haystack)

strpos($haystack, $needle)

Unicode support*

Errors and Exceptions*

Extensions are hit-or-miss

Weaknesses: Scaling/Speed

Overhead with single-request scopeMove session storage to memory

In-memory cache (Memcached/APC)

Database

Clustered software (Zend Platform, etc.)

Bytecode caching (APC, Xcache, etc.)

Weaknesses: Thread Safety

Linux/UnixFastCGI

Non-thread safe

WindowsMost 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

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso