SlideShare une entreprise Scribd logo
1  sur  45
Télécharger pour lire hors ligne
What’s New In
                              PHP 5.3?
                            PHP UK February 2009
                               Scott MacVicar




Friday, 27 February 2009
Feature Release


                           All PHP 5 code should still works

                           Backports everything except Unicode
                           from 6

                           Bug fixes from PHP 5.2




Friday, 27 February 2009
Namespaces
                           Mostly done at compile time

                           Saves extra long prefixes (Yay
                           framework developers)

                           Zend_Search_Lucene_Analysis_Analyzer_

                           Reduces class name conflicts

                           Multiple namespaces per file


Friday, 27 February 2009
Namespace Usage

                           Can Contain:

                             classes

                             functions

                             constants with the same name

                           Defined by statement namespace <x>;



Friday, 27 February 2009
as separator
Friday, 27 February 2009
You used ?!? WTF?
                           Symbol     Use     Symbol     Use

                             %      Modulus     +        Plus

                             ^        Xor       -       Minus

                             *       Multi      /      Division

                             ~        Not               ???

                             |        Or        :        Else

                             &        And       `        Exec


Friday, 27 February 2009
Namespaces example




Friday, 27 February 2009
Namespaces example




Friday, 27 February 2009
Namespaces example




Friday, 27 February 2009
Other Namespace
                                  Things
                           __NAMESPACE__

                           global scope 

                           __autoload(), get_class() and
                           get_parent_class() now return a full
                           qualified classname

                           Resolves internally then externally



Friday, 27 February 2009
Namespace Oddities




Friday, 27 February 2009
Late Static Binding

                           Static references use to be resolved
                           at compile time

                           Static constants would correspond to
                           where they were defined

                           static:: is now resolved at runtime




Friday, 27 February 2009
LSB Example 1




Friday, 27 February 2009
LSB Example 2




Friday, 27 February 2009
Lambda Functions and
                    Closures
                           Functions on the fly

                           Ideal for things that require a
                           callback

                           create_function() is runtime based

                           __invoke method for Classes



Friday, 27 February 2009
Example - 1




Friday, 27 February 2009
Example - 2




Friday, 27 February 2009
Garbage Collector

                           GSoC 2007 Project

                           Looks for cyclic references

                           Increases overall memory usage
                           slightly

                           Good for long running scripts



Friday, 27 February 2009
Cyclic Reference




Friday, 27 February 2009
Garbage Collector
                                 Usage




Friday, 27 February 2009
Dynamic Static Calls




Friday, 27 February 2009
Improved ini
                                  handling

                           Change PHP settings similarly
                           to .htaccess when using FCGI

                           Per-directory ini settings

                           INI constants / variables




Friday, 27 February 2009
INI Example




Friday, 27 February 2009
__callStatic


                           __callStatic($name, $arguments)

                           Identical to __call but for static
                           methods




Friday, 27 February 2009
__callStatic example




Friday, 27 February 2009
Limited goto


                           goto is a bad idea™

                           PHP provides goto <label>

                           Can only jump out of a structure




Friday, 27 February 2009
goto example




Friday, 27 February 2009
?: Operator




Friday, 27 February 2009
SPL Improvements
                           DualIterator         SplStack

                           RecursiveTreeItera   SplQueue
                           tor
                                                SplHeap
                           SplArrayReference
                                                SplFixedArray
                           DirectoryIterator
                           implements
                           ArrayAccess



Friday, 27 February 2009
NOWDOC
                           Like heredoc but without evaluation




Friday, 27 February 2009
enchant

                           Speel Cheking

                           Wraps around existing libraries

                           Supports platform dictionaries

                             HunSpell (Firefox, OpenOffice)

                             AppleSpell (OS X default)



Friday, 27 February 2009
fileinfo

                           Guess content type and encoding

                           Looks for magic byte sequences

                           Previously required external library

                           Provides mime_content_type() support




Friday, 27 February 2009
intl

                           Wrapper around IBM’s ICU library

                           Provides collation, normalization,
                           datetime and number / currency
                           formatting

                           IDN Support




Friday, 27 February 2009
MySQLnd

                           Developed by MySQL

                           Replaces libmysql and is bundled

                           Faster and uses less memory

                           Statistics




Friday, 27 February 2009
phar

                           Similar to Java’s JAR

                           PHP 5.3 can open and read phars

                           Can mount internal phar directories
                           Phar::mount(“cache/”, “/tmp/cache”);

                           Works with OPCode caches



Friday, 27 February 2009
Phar Example




Friday, 27 February 2009
Using Phar


                           Make a stub file

                           Build archive

                           Rejoice




Friday, 27 February 2009
SQLite3

                           OO API

                           Replaces old SQLite class

                           Bundles full text search

                           SQLite 3.6.11




Friday, 27 February 2009
Extensions removed
                           dbase     sybase

                           fbsql

                           fdf

                           ncurses

                           ming

                           pspell



Friday, 27 February 2009
New Constants
                           __DIR__              PHP_DEBUG

                           PHP_MAJOR_VERSION    PHP_MAXPATHLEN

                           PHP_MINOR_VERSION

                           PHP_RELEASE_VERSIO
                           N

                           PHP_VERSION_ID




Friday, 27 February 2009
Improved Performance

                           New scanner based on re2c

                           md5() now faster

                           require_once / include_once faster on
                           second usage

                           Improved memory usage due to
                           constants being marked as read only



Friday, 27 February 2009
Improved Performance

                           Improved engine stack implementation

                           Removed direct executor recursion

                           Use fastcall calling convention on
                           x86

                           Various opcode optimisations



Friday, 27 February 2009
Miscellaneous
                           Over 180 bug fixes

                           PCRE upgrade

                           SQLite upgrade

                           Stream improvements

                           OpenSSL improvements

                           Make JSON suck less


Friday, 27 February 2009
Beers for Bugs




Friday, 27 February 2009
Questions?
                           Go download and test!

                             http://qa.php.net/

                             http://windows.php.net/
                             downloads.php

                           Slides

                             http://talks.macvicar.net


Friday, 27 February 2009

Contenu connexe

Similaire à PHP 5.3

Pré Descobrimento Do Brasil
Pré Descobrimento Do BrasilPré Descobrimento Do Brasil
Pré Descobrimento Do Brasil
ecsette
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
elliando dias
 

Similaire à PHP 5.3 (11)

PHP 5.3 + Windows
PHP 5.3 + WindowsPHP 5.3 + Windows
PHP 5.3 + Windows
 
intl me this, intl me that
intl me this, intl me thatintl me this, intl me that
intl me this, intl me that
 
Geek Meet: Web Typography and sIFR 3
Geek Meet: Web Typography and sIFR 3Geek Meet: Web Typography and sIFR 3
Geek Meet: Web Typography and sIFR 3
 
Linq Refresher
Linq RefresherLinq Refresher
Linq Refresher
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
P4 P Update January 2009
P4 P Update January 2009P4 P Update January 2009
P4 P Update January 2009
 
Ebay News 2000 10 19 Earnings
Ebay News 2000 10 19 EarningsEbay News 2000 10 19 Earnings
Ebay News 2000 10 19 Earnings
 
Ebay News 2001 4 19 Earnings
Ebay News 2001 4 19 EarningsEbay News 2001 4 19 Earnings
Ebay News 2001 4 19 Earnings
 
Pré Descobrimento Do Brasil
Pré Descobrimento Do BrasilPré Descobrimento Do Brasil
Pré Descobrimento Do Brasil
 
Developing Cocoa Applications with macRuby
Developing Cocoa Applications with macRubyDeveloping Cocoa Applications with macRuby
Developing Cocoa Applications with macRuby
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

PHP 5.3

  • 1. What’s New In PHP 5.3? PHP UK February 2009 Scott MacVicar Friday, 27 February 2009
  • 2. Feature Release All PHP 5 code should still works Backports everything except Unicode from 6 Bug fixes from PHP 5.2 Friday, 27 February 2009
  • 3. Namespaces Mostly done at compile time Saves extra long prefixes (Yay framework developers) Zend_Search_Lucene_Analysis_Analyzer_ Reduces class name conflicts Multiple namespaces per file Friday, 27 February 2009
  • 4. Namespace Usage Can Contain: classes functions constants with the same name Defined by statement namespace <x>; Friday, 27 February 2009
  • 5. as separator Friday, 27 February 2009
  • 6. You used ?!? WTF? Symbol Use Symbol Use % Modulus + Plus ^ Xor - Minus * Multi / Division ~ Not ??? | Or : Else & And ` Exec Friday, 27 February 2009
  • 10. Other Namespace Things __NAMESPACE__ global scope __autoload(), get_class() and get_parent_class() now return a full qualified classname Resolves internally then externally Friday, 27 February 2009
  • 12. Late Static Binding Static references use to be resolved at compile time Static constants would correspond to where they were defined static:: is now resolved at runtime Friday, 27 February 2009
  • 13. LSB Example 1 Friday, 27 February 2009
  • 14. LSB Example 2 Friday, 27 February 2009
  • 15. Lambda Functions and Closures Functions on the fly Ideal for things that require a callback create_function() is runtime based __invoke method for Classes Friday, 27 February 2009
  • 16. Example - 1 Friday, 27 February 2009
  • 17. Example - 2 Friday, 27 February 2009
  • 18. Garbage Collector GSoC 2007 Project Looks for cyclic references Increases overall memory usage slightly Good for long running scripts Friday, 27 February 2009
  • 20. Garbage Collector Usage Friday, 27 February 2009
  • 21. Dynamic Static Calls Friday, 27 February 2009
  • 22. Improved ini handling Change PHP settings similarly to .htaccess when using FCGI Per-directory ini settings INI constants / variables Friday, 27 February 2009
  • 23. INI Example Friday, 27 February 2009
  • 24. __callStatic __callStatic($name, $arguments) Identical to __call but for static methods Friday, 27 February 2009
  • 26. Limited goto goto is a bad idea™ PHP provides goto <label> Can only jump out of a structure Friday, 27 February 2009
  • 27. goto example Friday, 27 February 2009
  • 28. ?: Operator Friday, 27 February 2009
  • 29. SPL Improvements DualIterator SplStack RecursiveTreeItera SplQueue tor SplHeap SplArrayReference SplFixedArray DirectoryIterator implements ArrayAccess Friday, 27 February 2009
  • 30. NOWDOC Like heredoc but without evaluation Friday, 27 February 2009
  • 31. enchant Speel Cheking Wraps around existing libraries Supports platform dictionaries HunSpell (Firefox, OpenOffice) AppleSpell (OS X default) Friday, 27 February 2009
  • 32. fileinfo Guess content type and encoding Looks for magic byte sequences Previously required external library Provides mime_content_type() support Friday, 27 February 2009
  • 33. intl Wrapper around IBM’s ICU library Provides collation, normalization, datetime and number / currency formatting IDN Support Friday, 27 February 2009
  • 34. MySQLnd Developed by MySQL Replaces libmysql and is bundled Faster and uses less memory Statistics Friday, 27 February 2009
  • 35. phar Similar to Java’s JAR PHP 5.3 can open and read phars Can mount internal phar directories Phar::mount(“cache/”, “/tmp/cache”); Works with OPCode caches Friday, 27 February 2009
  • 36. Phar Example Friday, 27 February 2009
  • 37. Using Phar Make a stub file Build archive Rejoice Friday, 27 February 2009
  • 38. SQLite3 OO API Replaces old SQLite class Bundles full text search SQLite 3.6.11 Friday, 27 February 2009
  • 39. Extensions removed dbase sybase fbsql fdf ncurses ming pspell Friday, 27 February 2009
  • 40. New Constants __DIR__ PHP_DEBUG PHP_MAJOR_VERSION PHP_MAXPATHLEN PHP_MINOR_VERSION PHP_RELEASE_VERSIO N PHP_VERSION_ID Friday, 27 February 2009
  • 41. Improved Performance New scanner based on re2c md5() now faster require_once / include_once faster on second usage Improved memory usage due to constants being marked as read only Friday, 27 February 2009
  • 42. Improved Performance Improved engine stack implementation Removed direct executor recursion Use fastcall calling convention on x86 Various opcode optimisations Friday, 27 February 2009
  • 43. Miscellaneous Over 180 bug fixes PCRE upgrade SQLite upgrade Stream improvements OpenSSL improvements Make JSON suck less Friday, 27 February 2009
  • 44. Beers for Bugs Friday, 27 February 2009
  • 45. Questions? Go download and test! http://qa.php.net/ http://windows.php.net/ downloads.php Slides http://talks.macvicar.net Friday, 27 February 2009