Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP 5.3 Part 1 - Introduction to PHP 5.3

2,986 views

Published on

This is part 1 in a series about PHP 5.3.

Published in: Technology
  • Be the first to comment

PHP 5.3 Part 1 - Introduction to PHP 5.3

  1. 1. PHP 5.3 – Part 1 Introduction to PHP 5.3 A Sydney PHP Group Presentation 4 th September 2008 By Timothy Chandler
  2. 2. So what’s the big deal!? <ul><li>PHP 5.3 = PHP 6 - Unicode + MORE! </li></ul><ul><li>Tomorrow’s PHP Today. </li></ul><ul><li>Forwards Compatibility. </li></ul>
  3. 3. So what’s new? <ul><li>New Syntax </li></ul><ul><li>New Functions & Methods </li></ul><ul><li>New Extensions </li></ul><ul><li>Namespaces </li></ul><ul><li>Lambda Functions & Closures </li></ul><ul><li>Late Static Binding </li></ul><ul><li>Lots of important changes </li></ul><ul><li>A few gotchas. </li></ul>
  4. 4. Important Changes & Gotchas <ul><li>Functions </li></ul><ul><ul><li>Array functions “next()” & “current()” no longer work with objects. </li></ul></ul><ul><ul><li>“ session_start()” will now return a Boolean response “false” if it fails to start a session. </li></ul></ul><ul><ul><li>By default, “ clearstatcache()” will no longer clear “realpath()” cache. </li></ul></ul>Backwards Compatibility
  5. 5. Important Changes & Gotchas <ul><li>Magic Methods </li></ul><ul><ul><li>All magic methods must now be declared as “public”. “static” declarations are no longer allowed. </li></ul></ul><ul><ul><li>“ __toString()” will no longer accept any parameters. </li></ul></ul>Backwards Compatibility
  6. 6. Important Changes & Gotchas <ul><li>New Reserved Words </li></ul><ul><ul><li>“ namespace” </li></ul></ul><ul><ul><li>“ goto” </li></ul></ul><ul><li>New Reserved Classes </li></ul><ul><ul><li>“ Closure” </li></ul></ul>Backwards Compatibility
  7. 7. Important Changes & Gotchas <ul><li>Depreciations </li></ul><ul><ul><li>Ticks </li></ul></ul><ul><ul><ul><li>This includes “register_tick_function()” </li></ul></ul></ul><ul><li>Undepreciations </li></ul><ul><ul><li>“ is_a()” </li></ul></ul>Backwards Compatibility
  8. 8. Important Changes & Gotchas <ul><li>Windows </li></ul><ul><ul><li>Any Windows OS prior to Windows 2000 is no longer supported. </li></ul></ul>Backwards Compatibility
  9. 9. Important Changes & Gotchas <ul><li>Removed </li></ul><ul><ul><li>ncurses </li></ul></ul><ul><ul><li>fpdf </li></ul></ul><ul><ul><li>sybase </li></ul></ul><ul><ul><li>dbase </li></ul></ul><ul><ul><li>fbsql </li></ul></ul>Extensions <ul><li>Added </li></ul><ul><ul><li>Phar </li></ul></ul><ul><ul><li>Internationalization (Intl) </li></ul></ul><ul><ul><li>File Information (Fileinfo) </li></ul></ul><ul><ul><li>SQLite3 </li></ul></ul>
  10. 10. Important Changes & Gotchas <ul><li>Not allowed to disable. </li></ul><ul><ul><li>PCRE </li></ul></ul><ul><ul><li>Reflections </li></ul></ul><ul><ul><li>SPL </li></ul></ul>Extensions
  11. 11. Important Changes & Gotchas <ul><li>More powerful ini. </li></ul><ul><li>A whole slew of changes which may or may not affect you. </li></ul>The PHP INI File
  12. 12. New Syntax <ul><li>It’s like HEREDOC, but it doesn’t evaluate it’s contents. </li></ul><ul><li>Syntax: </li></ul><ul><li><<<‘NOWDOC’ </li></ul><ul><li><CONTENT> </li></ul><ul><li>NOWDOC; </li></ul><ul><li>“ NOWDOC”, like “HEREDOC”, can be replaced with any non-reserved word. </li></ul>NOWDOC
  13. 13. New Syntax <ul><li>The Ternary Operator has been given a shortcut. </li></ul><ul><li>Testing for only “true” or “false” is now possible. </li></ul><ul><li>Syntax: </li></ul><ul><li>$foo=true; </li></ul><ul><li>!$foo?:print '$foo is True<br />'; </li></ul><ul><li>$bar=false; </li></ul><ul><li>$bar?:print '$bar is False<br />'; </li></ul>Ternary Operator
  14. 14. New Syntax <ul><li>You can now cast a variable to NULL while using it and remove it from memory in one fell swoop. </li></ul><ul><li>Syntax: </li></ul><ul><li>$foo='foo'; </li></ul><ul><li>$foo=(unset)print $foo; </li></ul>Unset Casting
  15. 15. New Syntax <ul><li>The new “goto” keyword is useful for controlling breaks in loops and switches. </li></ul><ul><li>Not recommended outside of loops and switches. </li></ul><ul><li>Easy to abuse – be careful with your GCP. </li></ul><ul><li>Syntax: </li></ul><ul><li>print 1; </li></ul><ul><li>goto label1; </li></ul><ul><li>print 2; </li></ul><ul><li>print 3; </li></ul><ul><li>label1: </li></ul><ul><li>print 4; </li></ul>goto
  16. 16. New Functions & Methods <ul><li>Too many for this presentation. </li></ul><ul><li>They include: </li></ul><ul><ul><li>Array </li></ul></ul><ul><ul><li>Date </li></ul></ul><ul><ul><li>GMP </li></ul></ul><ul><ul><li>Hash </li></ul></ul><ul><ul><li>Image </li></ul></ul><ul><ul><li>Math </li></ul></ul><ul><ul><li>Mcrypt </li></ul></ul><ul><ul><li>Network </li></ul></ul><ul><ul><li>PCNTL </li></ul></ul><ul><ul><li>PHP Core </li></ul></ul><ul><ul><li>SHM </li></ul></ul><ul><ul><li>SPL </li></ul></ul><ul><ul><li>Streams </li></ul></ul><ul><ul><li>Strings </li></ul></ul>
  17. 17. New Functions & Methods <ul><li>“ array_replace()” – Finds and replaces based on key and merges the remainder. </li></ul><ul><li>“ array_replace_recursive()” – Recursively finds and replaces based on key and merges the remainder. </li></ul>Array Functions
  18. 18. New Functions & Methods <ul><li>“ date_add()” – Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object. </li></ul><ul><li>“ date_sub()” – Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object </li></ul><ul><li>“ date_diff()” – Takes two DateTime Objects and calculates the difference. </li></ul>Date Functions
  19. 19. New Functions & Methods <ul><li>“ class_alias()” – Creates an alias of a class name. </li></ul><ul><li>“ forward_static_call()” and “forward_static_call_array()” – Related to Late Static Binding. This will be discussed in another presentation. </li></ul>PHP Core
  20. 20. Coming Up <ul><li>October </li></ul><ul><ul><li>Part 2 – New PHP Internals </li></ul></ul><ul><ul><ul><li>Lambda Functions and Closures </li></ul></ul></ul><ul><ul><ul><li>Namespaces – maybe? </li></ul></ul></ul><ul><li>November </li></ul><ul><ul><li>Part 3 – New PHP Extensions </li></ul></ul><ul><ul><ul><li>Internationalization </li></ul></ul></ul><ul><ul><ul><li>Phar </li></ul></ul></ul>

×