SlideShare a Scribd company logo
1 of 19
Introduction in PHP5



Jeroen van Sluijs
Software Engineer
Ibuildings.nl
                    Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
About ibuildings.nl
  • PHP development since 1999
  • Vlissingen, Amsterdam, Sittard, London
  • 43 employees, 18 ZCE
      •   jobs@ibuildings.nl

  • ‘Official Zend Representative’ for Benelux and Scandinavie
         PHP5-migration support and training
         Professionalise PHP in Netherlands

      Professional Services
  •

         Consulting for PHP projects, applications and infrastructure
         Development-methods and software processes
         Application auditing (scalability, performance, security)
         Zend Onsite Training (PHP, Products)
Short Term Benefits




Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
Out of the Box Enhancements
• The migration will present performance
  enhancements
• Immediate robust improvements with almost no effort
• There is no need to redesign your application!
• Your code only needs to be adjusted to run on PHP5




                                                        4/19
Migrating To Php5
• Only 5 (major) things to take in account
   in order to migrate from PHP4 to PHP5:
    Direct assignment in a class to $this is not allowed anymore
    Function array_merge no longer accepts no-array parameters
    Functions strrpos and strripos search the full $needle
      parameter

    Function get_class returns the case-preserved version of the
      class name (Case sensitive)

    Objects always passed by reference

• No new development on PHP4 besides security fixes


                                                                    5/19
Immediate Benefits #1
• Improved Security
      echo filter_var($int, FILTER_VALIDATE_INT);

• Flexibility
    Programming both OO and Procedural code

• Better error handling using exceptions
• Native support for modern web technologies
    JSON (Javascript object notation)
    SOAP (Simple Object Access Protocol)
    Better and faster XML processing (DOM, SimpleXML and more..)
       • 20-50% faster in PHP5.2.1
    Better MVC frameworks (Zend Framework, Symfony, Prado)



                                                              6/19
Immediate Benefits #2

• Test compares PHP binaries 4.4.4, 5.0.5, 5.1.6 and 5.2.0

• Several scripts tested
    Simple scripts
    Complex object oriented




                                                         7/19
PHP4 vs. PHP5 Statistics




                           8/19
Long Term Benefits




Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
Object Oriented Programming
in PHP5
• OOP improves your application development in the
   following areas:

    Modular development
    Code is much easier to maintain
    Exceptions allow much easier error handling
    Object Oriented Programming




                                                     10/19
PHP5 Features
In Details #1

 • Improved object model
    1.   Visibility (PPP) - Public, Protected, Private, Final
    2.   Abstraction
    3.   Interfaces
    4.   Object constructors and destructors
    5.   Magic methods
    6.   Type hinting
    7.   Static class properties




                                                                11/19
PHP5 Features
In Details #2

 • New Exception Model (try/catch/throw)
    try {
     if ($error) {
       throw new Exception (“This is my error”);
      }
     } catch (Exception $e) {
       // handle exception
    }

 • Introspection/Reflection
    echo reflection_method::export('Foo', 'func');


 • Iterators (SPL)
     Access Objects as Arrays
    $dir = new DirectoryIterator('.');
      foreach ($dir as $file) {
        echo $file.quot;rnquot;;
      }


                                                     12/19
PHP5 Features
In Details #3

• Native SOAP/WSDL support
     SOAP Server and SOAP Client
       • class MySOAPServer {
           public function getMessage() {
                return “Hello World!”;
          }};
       • $options = array('uri'='http://example.org/soap/server');
       • $server = new SoapServer(NULL, $options);
       • $client = new SoapClient(NULL, $options);
         echo $client->getMessage();



• Many new array and stream functions




                                                                     13/19
PHP5 Features
In Details #4

• Improved Native XML support
    The XML implementation in PHP5 was completely rewritten
    XML files are extremely simple to read and modify
    SimpleXML - a vastly improved XML accessing technique that
      can reduce the total code required

      $library = simplexml_load_file('library.xml');

      foreach ($library->book as $book) {
          echo $book['isbn']; // attribute
          echo $book->title; // element};




                                                               14/19
PHP5 Features
In Details #5

• Database Improvements
     PDO: Identical OO interface to many DB systems (MySQL,
      SQLite, Oracle, DB2, Postgres, Informix, ODBC)

     Prepared statements
       $stmt = $mysqli->prepare(quot;INSERT INTO car VALUES (?, ?, ?)quot;);
       $stmt->bind_param('ssd', $brand, $type, $nof_tyres);

       $brand = 'Mazda';
       ...
       $stmt->execute();




                                                                       15/19
Zend Core 2.0
A supported Certified PHP5 Binary

• Zend Core. Distribution for PHP5
• Advantages:
    All components included in a simple setup:
      • PHP5
      • Zend Framework
      • MySQL
      • Apache
      • phpMyAdmin
    Security
    Stability
    Enhanced - Includes fully tested and certified PHP extensions
      such as DB drivers, XML, Web Services, LDAP and more…



                                                                16/19
Zend Core 2.0
A supported Certified PHP5 Binary

• The perfect Web application development environment




                                                  17/19
More information

  • General Info
     http://www.ibuildings.nl
     http://www.zend.com
     http://www.php.net

     info@ibuildings.nl

  • Migration Guide
     http://www.php.net/manual/en/migration5.php




                                                    18/19
Thank you.




        Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.

More Related Content

What's hot

Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程
jeffz
 
PHP Introduction ( Fedora )
PHP Introduction ( Fedora )PHP Introduction ( Fedora )
PHP Introduction ( Fedora )
Kishore Kumar
 

What's hot (20)

Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Professional PHP: an open-source alternative for enterprise development [Kort...
Professional PHP: an open-source alternative for enterprise development [Kort...Professional PHP: an open-source alternative for enterprise development [Kort...
Professional PHP: an open-source alternative for enterprise development [Kort...
 
Hidden Gems in ColdFusion 11
Hidden Gems in ColdFusion 11Hidden Gems in ColdFusion 11
Hidden Gems in ColdFusion 11
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimization
 
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia APIPOX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
 
PHP Project PPT
PHP Project PPTPHP Project PPT
PHP Project PPT
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
php_tizag_tutorial
php_tizag_tutorialphp_tizag_tutorial
php_tizag_tutorial
 
Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10Php through the eyes of a hoster: PHPNW10
Php through the eyes of a hoster: PHPNW10
 
Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程Documentation Insight技术架构与开发历程
Documentation Insight技术架构与开发历程
 
php basics
php basicsphp basics
php basics
 
Api Design
Api DesignApi Design
Api Design
 
PHP and Web Services
PHP and Web ServicesPHP and Web Services
PHP and Web Services
 
PHP Introduction ( Fedora )
PHP Introduction ( Fedora )PHP Introduction ( Fedora )
PHP Introduction ( Fedora )
 
The Skinny on Slim
The Skinny on SlimThe Skinny on Slim
The Skinny on Slim
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
PHP7.1 New Features & Performance
PHP7.1 New Features & PerformancePHP7.1 New Features & Performance
PHP7.1 New Features & Performance
 
Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)Phing - A PHP Build Tool (An Introduction)
Phing - A PHP Build Tool (An Introduction)
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)Enterprise PHP (php|works 2008)
Enterprise PHP (php|works 2008)
 

Viewers also liked (6)

Community Wireless Networks
Community Wireless NetworksCommunity Wireless Networks
Community Wireless Networks
 
Rails南蛮通事
Rails南蛮通事Rails南蛮通事
Rails南蛮通事
 
Supernova
SupernovaSupernova
Supernova
 
PresentacióN De Des Encuentro
PresentacióN De Des EncuentroPresentacióN De Des Encuentro
PresentacióN De Des Encuentro
 
Bears Do Shit In The Woods
Bears Do Shit In The WoodsBears Do Shit In The Woods
Bears Do Shit In The Woods
 
Quemalaeslaenvidia
QuemalaeslaenvidiaQuemalaeslaenvidia
Quemalaeslaenvidia
 

Similar to Introduction into PHP5 (Jeroen van Sluijs)

Similar to Introduction into PHP5 (Jeroen van Sluijs) (20)

Migrating from PHP4 To PHP5 - Zend Webinar
Migrating from PHP4 To PHP5 - Zend WebinarMigrating from PHP4 To PHP5 - Zend Webinar
Migrating from PHP4 To PHP5 - Zend Webinar
 
Becoming A Php Ninja
Becoming A Php NinjaBecoming A Php Ninja
Becoming A Php Ninja
 
PHP Toolkit from Zend and IBM: Open Source on IBM i
PHP Toolkit from Zend and IBM: Open Source on IBM iPHP Toolkit from Zend and IBM: Open Source on IBM i
PHP Toolkit from Zend and IBM: Open Source on IBM i
 
Start using PHP 7
Start using PHP 7Start using PHP 7
Start using PHP 7
 
Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008Enterprise PHP Development - ZendCon 2008
Enterprise PHP Development - ZendCon 2008
 
Integrating PHP With System-i using Web Services
Integrating PHP With System-i using Web ServicesIntegrating PHP With System-i using Web Services
Integrating PHP With System-i using Web Services
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)
 
How To Start Up With PHP In IBM i
How To Start Up With PHP In IBM iHow To Start Up With PHP In IBM i
How To Start Up With PHP In IBM i
 
How To Start Up With Php In Ibm I
How To Start Up With Php In Ibm IHow To Start Up With Php In Ibm I
How To Start Up With Php In Ibm I
 
PHP Batch Jobs on IBM i
PHP Batch Jobs on IBM iPHP Batch Jobs on IBM i
PHP Batch Jobs on IBM i
 
Unleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ PlatformUnleash your Symfony projects with eZ Platform
Unleash your Symfony projects with eZ Platform
 
Current state-of-php
Current state-of-phpCurrent state-of-php
Current state-of-php
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
第1回PHP拡張勉強会
第1回PHP拡張勉強会第1回PHP拡張勉強会
第1回PHP拡張勉強会
 
green
greengreen
green
 
Phpyahoo
PhpyahooPhpyahoo
Phpyahoo
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Building and managing applications fast for IBM i
Building and managing applications fast for IBM iBuilding and managing applications fast for IBM i
Building and managing applications fast for IBM i
 

More from Stefan Koopmanschap

Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)
Stefan Koopmanschap
 

More from Stefan Koopmanschap (20)

A Practical Look At Symfony2
A Practical Look At Symfony2A Practical Look At Symfony2
A Practical Look At Symfony2
 
Git for Subversion Users (ZendCon 2011)
Git for Subversion Users (ZendCon 2011)Git for Subversion Users (ZendCon 2011)
Git for Subversion Users (ZendCon 2011)
 
A Practical Look at Symfony2 (PHPNW11)
A Practical Look at Symfony2 (PHPNW11)A Practical Look at Symfony2 (PHPNW11)
A Practical Look at Symfony2 (PHPNW11)
 
Git For Subversion Users (PHPNW11)
Git For Subversion Users (PHPNW11)Git For Subversion Users (PHPNW11)
Git For Subversion Users (PHPNW11)
 
Conference Speaking 101
Conference Speaking 101Conference Speaking 101
Conference Speaking 101
 
Open Up (International PHP Conference Spring Edition 2011)
Open Up (International PHP Conference Spring Edition 2011)Open Up (International PHP Conference Spring Edition 2011)
Open Up (International PHP Conference Spring Edition 2011)
 
Git for Subversion Users (phpDay 2011)
Git for Subversion Users (phpDay 2011)Git for Subversion Users (phpDay 2011)
Git for Subversion Users (phpDay 2011)
 
Would you like docs with that? - Zend Webinar
Would you like docs with that? - Zend WebinarWould you like docs with that? - Zend Webinar
Would you like docs with that? - Zend Webinar
 
Git workshop (2value, 14-12-2010)
Git workshop (2value, 14-12-2010)Git workshop (2value, 14-12-2010)
Git workshop (2value, 14-12-2010)
 
Git Workshop (Pfz Workshopdag)
Git Workshop (Pfz Workshopdag)Git Workshop (Pfz Workshopdag)
Git Workshop (Pfz Workshopdag)
 
Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)
 
Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)Would you like docs with that? (IPC 2010)
Would you like docs with that? (IPC 2010)
 
Integrating symfony and Zend Framework (IPC 2010)
Integrating symfony and Zend Framework (IPC 2010)Integrating symfony and Zend Framework (IPC 2010)
Integrating symfony and Zend Framework (IPC 2010)
 
symfony 1.4 workshop
symfony 1.4 workshopsymfony 1.4 workshop
symfony 1.4 workshop
 
Would you like docs with that? (Pfcongres 2010)
Would you like docs with that? (Pfcongres 2010)Would you like docs with that? (Pfcongres 2010)
Would you like docs with that? (Pfcongres 2010)
 
The Symfony Community - How to (get) help
The Symfony Community - How to (get) helpThe Symfony Community - How to (get) help
The Symfony Community - How to (get) help
 
Integrating symfony and Zend Framework (PHPBarcelona 2009)
Integrating symfony and Zend Framework (PHPBarcelona 2009)Integrating symfony and Zend Framework (PHPBarcelona 2009)
Integrating symfony and Zend Framework (PHPBarcelona 2009)
 
Integrating symfony and Zend Framework (PHPNW09)
Integrating symfony and Zend Framework (PHPNW09)Integrating symfony and Zend Framework (PHPNW09)
Integrating symfony and Zend Framework (PHPNW09)
 
Integrating symfony and Zend Framework
Integrating symfony and Zend FrameworkIntegrating symfony and Zend Framework
Integrating symfony and Zend Framework
 
Scrum (dutch)
Scrum (dutch)Scrum (dutch)
Scrum (dutch)
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

Introduction into PHP5 (Jeroen van Sluijs)

  • 1. Introduction in PHP5 Jeroen van Sluijs Software Engineer Ibuildings.nl Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  • 2. About ibuildings.nl • PHP development since 1999 • Vlissingen, Amsterdam, Sittard, London • 43 employees, 18 ZCE • jobs@ibuildings.nl • ‘Official Zend Representative’ for Benelux and Scandinavie  PHP5-migration support and training  Professionalise PHP in Netherlands Professional Services •  Consulting for PHP projects, applications and infrastructure  Development-methods and software processes  Application auditing (scalability, performance, security)  Zend Onsite Training (PHP, Products)
  • 3. Short Term Benefits Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  • 4. Out of the Box Enhancements • The migration will present performance enhancements • Immediate robust improvements with almost no effort • There is no need to redesign your application! • Your code only needs to be adjusted to run on PHP5 4/19
  • 5. Migrating To Php5 • Only 5 (major) things to take in account in order to migrate from PHP4 to PHP5:  Direct assignment in a class to $this is not allowed anymore  Function array_merge no longer accepts no-array parameters  Functions strrpos and strripos search the full $needle parameter  Function get_class returns the case-preserved version of the class name (Case sensitive)  Objects always passed by reference • No new development on PHP4 besides security fixes 5/19
  • 6. Immediate Benefits #1 • Improved Security  echo filter_var($int, FILTER_VALIDATE_INT); • Flexibility  Programming both OO and Procedural code • Better error handling using exceptions • Native support for modern web technologies  JSON (Javascript object notation)  SOAP (Simple Object Access Protocol)  Better and faster XML processing (DOM, SimpleXML and more..) • 20-50% faster in PHP5.2.1  Better MVC frameworks (Zend Framework, Symfony, Prado) 6/19
  • 7. Immediate Benefits #2 • Test compares PHP binaries 4.4.4, 5.0.5, 5.1.6 and 5.2.0 • Several scripts tested  Simple scripts  Complex object oriented 7/19
  • 8. PHP4 vs. PHP5 Statistics 8/19
  • 9. Long Term Benefits Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  • 10. Object Oriented Programming in PHP5 • OOP improves your application development in the following areas:  Modular development  Code is much easier to maintain  Exceptions allow much easier error handling  Object Oriented Programming 10/19
  • 11. PHP5 Features In Details #1 • Improved object model 1. Visibility (PPP) - Public, Protected, Private, Final 2. Abstraction 3. Interfaces 4. Object constructors and destructors 5. Magic methods 6. Type hinting 7. Static class properties 11/19
  • 12. PHP5 Features In Details #2 • New Exception Model (try/catch/throw) try { if ($error) { throw new Exception (“This is my error”); } } catch (Exception $e) { // handle exception } • Introspection/Reflection echo reflection_method::export('Foo', 'func'); • Iterators (SPL)  Access Objects as Arrays $dir = new DirectoryIterator('.'); foreach ($dir as $file) { echo $file.quot;rnquot;; } 12/19
  • 13. PHP5 Features In Details #3 • Native SOAP/WSDL support  SOAP Server and SOAP Client • class MySOAPServer { public function getMessage() { return “Hello World!”; }}; • $options = array('uri'='http://example.org/soap/server'); • $server = new SoapServer(NULL, $options); • $client = new SoapClient(NULL, $options); echo $client->getMessage(); • Many new array and stream functions 13/19
  • 14. PHP5 Features In Details #4 • Improved Native XML support  The XML implementation in PHP5 was completely rewritten  XML files are extremely simple to read and modify  SimpleXML - a vastly improved XML accessing technique that can reduce the total code required $library = simplexml_load_file('library.xml'); foreach ($library->book as $book) { echo $book['isbn']; // attribute echo $book->title; // element}; 14/19
  • 15. PHP5 Features In Details #5 • Database Improvements  PDO: Identical OO interface to many DB systems (MySQL, SQLite, Oracle, DB2, Postgres, Informix, ODBC)  Prepared statements $stmt = $mysqli->prepare(quot;INSERT INTO car VALUES (?, ?, ?)quot;); $stmt->bind_param('ssd', $brand, $type, $nof_tyres); $brand = 'Mazda'; ... $stmt->execute(); 15/19
  • 16. Zend Core 2.0 A supported Certified PHP5 Binary • Zend Core. Distribution for PHP5 • Advantages:  All components included in a simple setup: • PHP5 • Zend Framework • MySQL • Apache • phpMyAdmin  Security  Stability  Enhanced - Includes fully tested and certified PHP extensions such as DB drivers, XML, Web Services, LDAP and more… 16/19
  • 17. Zend Core 2.0 A supported Certified PHP5 Binary • The perfect Web application development environment 17/19
  • 18. More information • General Info  http://www.ibuildings.nl  http://www.zend.com  http://www.php.net  info@ibuildings.nl • Migration Guide  http://www.php.net/manual/en/migration5.php 18/19
  • 19. Thank you. Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.