Introduction in PHP5



Jeroen van Sluijs
Software Engineer
Ibuildings.nl
                    Copyright © 2007 Ibuildings....
About ibuildings.nl
  • PHP development since 1999
  • Vlissingen, Amsterdam, Sittard, London
  • 43 employees, 18 ZCE
   ...
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 a...
Migrating To Php5
• Only 5 (major) things to take in account
   in order to migrate from PHP4 to PHP5:
    Direct assignm...
Immediate Benefits #1
• Improved Security
      echo filter_var($int, FILTER_VALIDATE_INT);

• Flexibility
    Programmi...
Immediate Benefits #2

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

• Several scripts tested
    Simple sc...
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 d...
PHP5 Features
In Details #1

 • Improved object model
    1.   Visibility (PPP) - Public, Protected, Private, Final
    2....
PHP5 Features
In Details #2

 • New Exception Model (try/catch/throw)
    try {
     if ($error) {
       throw new Except...
PHP5 Features
In Details #3

• Native SOAP/WSDL support
     SOAP Server and SOAP Client
       • class MySOAPServer {
  ...
PHP5 Features
In Details #4

• Improved Native XML support
    The XML implementation in PHP5 was completely rewritten
  ...
PHP5 Features
In Details #5

• Database Improvements
     PDO: Identical OO interface to many DB systems (MySQL,
      SQ...
Zend Core 2.0
A supported Certified PHP5 Binary

• Zend Core. Distribution for PHP5
• Advantages:
    All components incl...
Zend Core 2.0
A supported Certified PHP5 Binary

• The perfect Web application development environment




               ...
More information

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

    ...
Thank you.




        Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
Upcoming SlideShare
Loading in...5
×

Introduction into PHP5 (Jeroen van Sluijs)

2,300

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,300
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction into PHP5 (Jeroen van Sluijs)"

  1. 1. Introduction in PHP5 Jeroen van Sluijs Software Engineer Ibuildings.nl Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  2. 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. 3. Short Term Benefits Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  4. 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. 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. 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. 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. 8. PHP4 vs. PHP5 Statistics 8/19
  9. 9. Long Term Benefits Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.
  10. 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. 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. 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. 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. 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. 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. 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. 17. Zend Core 2.0 A supported Certified PHP5 Binary • The perfect Web application development environment 17/19
  18. 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. 19. Thank you. Copyright © 2007 Ibuildings.nl / Zend Technologies LTD.

×