Should Be Using PHP 5

Stefan Priebsch, e-novative GmbH

50 Reasons Why You

#1 PHP 4 end of life 08/08/08

#2 PHP 4 as old as Win 2000

#3 PHP 5 is stable

#4 PHP 5 is faster than PHP 4*
* No, really

#5 XML support actually works

libxml-based DOM-compliant

#6 PHP 5 has SimpleXML

$xml = new SimpleXMLElement($doc); print $xml->movie[0]->plot;

#7 XMLWriter

Create XML files Stream-based, no DOM tree

#8 XMLReader

Parse XML files Stream-based, no DOM tree

#9 PHP 5 Supports OOP*
* Real OOP, that is

#10 PHP 5 can* copy objects
* can, as in: you decide when

clone Statement

#11 PHP 5 allows &-free code

#12 PHP 5 is more strict

PHP 4 allowed messy reference magic

#13

#13

#13

Superstitious?

#14 PHP 5 Autoloads objects

Register autoload handler(s)

#15 Visibility

methods and members public, protected, private

#16 Constructors, Destructors

public function __construct() public function __destruct()

#17 More magic methods

__get() __set() __toString() __sleep() __wakeup()

#18 Class Constants

less constants in global namespace, less potential name conflicts class Foo { } const FOO = 42;

#19 Interfaces

ensure certain methods are supported

#20 instanceOf

... a class ... a superclass ... an interface

#21 Type Hints

function do_something(Foo $aFoo) function do_something(array $aValues)

#22 Exceptions

handle non-fatal errors carry additional information no more === false checks

#23 Static members/methods

Bound to class instead of instance

#24 Iterators

$it = new DirectoryIterator('.'); foreach ($it as $item) { } print $item;

#25 PDO

One API for all databases

#26 mysqli

Supports advanced MySQL 4.1 features Stored Procedures

#27 A database in a box

SQLite In-memory database, loosely typed

#28 Choice of ORM Tools

#29 Propel

Generate mapper code from XML OOP interface to loading objects http://propel.phpdb.org/

#30 Doctrine

Define object relations at runtime OO Query Language http://www.phpdoctrine.org/

#31 Choice of Frameworks

#32 ezComponents

Component Library Database Email Logging Image Conversion http://ez.no/ezcomponents

#33 Zend Framework

Authentication ACL i18n Email Search Engine http://framework.zend.com/

#34 Symfony

PHP on Rails Mojavi-based MVC Persistence http://www.symfony-project.com

#35 PHPUnit

xUnit Framework for PHP Unit Tests, Acceptance Tests, http://www.phpunit.de System Tests, Functional Tests

#36 phing Build Automation

Port of Ant Platform-independent automation http://phing.info

#37 PHPDocumentor

Actually creates API documentation from the code in PHP 5

#38 Native SOAP support

$client = new SoapClient("test.wsdl");

#39 JSON support

json_encode($data_structure);

#40 ZIP extension

$zip = new ZipArchive(); $zip->open('test.zip'); $zip->extractTo('test');

#41 Filter extension

filter_var('info@e-novative.de', FILTER_VALIDATE_EMAIL); filter_var('www.e-novative.de', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED);

#42 Reflection API

Reverse-engineer classes, interfaces, functions, methods, and extensions

#43 PHP 5 does the cleaning

Tidy extension Clean up messy HTML Register as output handler

#44 LSB* in PHP 5.3
* Late Static Binding

class Foo { ... ...

static::doSomething(); }

#45 Namespaces in PHP 5.3

Less name conflicts Short class names namespace My::Project::DB;

#46 Unicode in PHP 6

At some point in the future

#47 gophp5.org

Mantis osCommerce Drupal phpMyAdmin PEAR Typo3

#48 My book

#49 My talk

„The gory details of a PHP migration“ Friday, 11:15 am, Rosemont

#50 PHP 5 is fun to do

Thank you.

Thank you.

http://inside.e-novative.de stefan.priebsch@e-novative.de

Sign up to vote on this title
UsefulNot useful