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