What's New In PHP 5.3: Volume One

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

  • + rotinpain rotinpain 2 weeks ago
    thank you for this good doc bout php 5.3 news
Post a comment
Embed Video
Edit your comment Cancel

5 Favorites & 1 Event

What's New In PHP 5.3: Volume One - Presentation Transcript

  1. What’s New in PHP 5.3
  2. Johannes Schlüter
  3. David Zülke
  4. PHP Awesomeness History Woot Level 100.000.000.000 100.000.000.000 75.000.000.000 75.000.000.000 50.000.000.000 25.000.000.000 1 10.000 100.000 1.000.000 1.500.000 2.000.000 0 PHP/FI PHP 3 PHP 4 PHP 5 PHP 5.1 PHP 5.2 PHP 5.3 PHP 6
  5. PHP Awesomeness History, on a logarithmic scale Woot Level 100.000.000.000 75.000.000.000 100.000.000.000 177.827.941 1.000.000 1.500.000 2.000.000 316.228 100.000 10.000 562 1 1 PHP/FI PHP 3 PHP 4 PHP 5 PHP 5.1 PHP 5.2 PHP 5.3 PHP 6
  6. Volume One Volume Two Namespaces PHAR Closures, Part One Closures, Part Two SPL Late Static Binding Stream Changes Operators, Syntax, Magic Date and Time Handling Methods & Constants ext/mysqlnd New & Removed ext/intl Extensions, BC getopt, OpenSSL, php.ini Windows Support Performance/Internals/GC
  7. What’s New in PHP 5.3 Volume One
  8. Name\\Spaces Because Underscores Are Not Enough
  9. Namespaceable Elements namespace Foo; const ANSWER = 42; echo Foo\\ANSWER; class C { /* ... */ } new Foo\\C(); function f() { } Foo\\f();
  10. Multiple Namespaces namespace Foo {     class C { /* ... */ } } namespace Bar {     class C { /* ... */ } }
  11. Namespaces Example #1 MyFramework/someModule/Foo.class.php: <?php namespace MyFramework\\someModule; class Foo { /* ... */  } ?> app/Bar.class.php: <?php class Bar extends MyFramework\\someModule\\Foo { /* ... */  } ?>
  12. Namespaces Example #2 MyFramework/someModule/Foo.class.php: <?php namespace MyFramework\\someModule; class Foo { /* ... */  } ?> MyFramework/someModule/Bar.class.php: <?php namespace MyFramework\\someModule; class Bar extends Foo { /* ... */  } ?>
  13. Namespaces: call_user_func // it's a string, so we need to use a FQN call_user_func_array(   array(     __NAMESPACE__.'\\some_class',     'method'   ),   $params );
  14. Class Resolution namespace MyFramework\\someModule; class PdoException { } new PdoException(); // MyFramework\\myModule new \\PdoException(); // ext/pdo new DateTime(); // class not found! new \\DateTime(); // works
  15. Function Resolution namespace MyFramework\\someModule; function strlen($param) {     return 0; } echo strlen(\"hello world\"); // 0 echo \\strlen(\"hello world\"); // 11 echo some\\other\\space\\strlen(\"hello world\");
  16. Using Namespaces foo/bar.php: <?php namespace foo\\bar; class class1 {} // foo\\bar\\class1 ?> some/code.php: <?php use foo\\bar; new bar\\class1(); ?>
  17. Aliasing foo/bar.php: <?php namespace foo\\bar; class class1 {} // foo\\bar\\class1 ?> some/code.php: <?php use foo\\bar as baz; use foo\\bar\\class1 as zomg; new baz\\class2(); new zomg(); ?>
  18. Closures Chapter One: The Basics
  19. Closures: Very Basic $array = array(3, 9, 2); array_filter(   $array,   function($element) {     return $element > 5;    } );
  20. Late Static Binding ohai, I’m in ur base, calling teh selfz
  21. The ActiveRecord example $user = User::findByID(23); echo \"Hello \" . $user‐>getName() . \"!\\n\"; $user‐>setPassword(\"verysecret\"); $user‐>save();
  22. Implementation (w/ Injection) abstract class ActiveRecord {   static function findById($id) {     $table= get_called_class();     $query = \"SELECT * FROM \" . $table . \" WHERE id=\" . $id;     /* .... */   } } class User extends ActiveRecord {} class Entry extends ActiveRecord {} $a = User::findById(2); $b = Entry::findById(4);
  23. self vs static with LSB class Base {   public static function m()   {     self::printName();     static::printName();   } Base   static function printName() Base   {     echo __CLASS__;   } } Base::m();
  24. self vs static with LSB class Extended extends Base {   static function printName()   { Base     echo __CLASS__; Extended   } }
  25. Operators, Syntax, Magic Methods & Constants And Exceptions That Eat Each Other
  26. __callStatic() class Foo {     public static function __callStatic($name, $args) {         echo $name;     } } Foo::boats(); boats
  27. Static Calls w/ $classname $cls = 'DateTime'; $cls::getLastErrors();
  28. Constants in Global Scope const EGG = 'bacon';
  29. NOWDOC echo <<<'BAI' Price: $US 375 BAI; Price: $US 375
  30. HEREDOC echo <<<\"BAI\" Price: $US 375 BAI; Notice: Undefined  variable: US...
  31. __DIR__ // old: function call, conditional include include(dirname(__FILE__) . '/brother.php'); // new: magic constant, no conditional include include(__DIR__ . '/brother.php');
  32. Exception Linking try {     $pdoStatement‐>execute(); } catch(PDOException $e) {     $up = new RuntimeException('PDO fell over', 0, $e);     throw $up; // lame joke, ain't it? }
  33. Ifsetor $id = $_GET[\"id\"] ?: 0;
  34. Notice: Undefined index: id
  35. goto label: durr; $i++; if($i < 100) {   goto durr; }
  36. New/Removed Extensions And Backwards Compatibility Changes
  37. New Extensions intl sqlite3 mysqlnd phar fileinfo enchant
  38. Removed Extensions msql dbase fbsql fdf Deprecated: ereg ncurses ming sybase (-> sybase_ct)
  39. Potential BC breaks New Keywords: Parameter parsing: objects not interpreted as arrays namespace anymore by these funcs: goto current, next, key, each, New global identifiers: reset, end New extensions natsort, natcasesort, usort, uasort, uksort New Closure class array_flip, array_unique zend.ze1_comptibility_mode
  40. call_user_func_array w/ refs function foo(&$param) {} // breaks call_user_func_array(\"foo\", array(23)); // breaks call_user_func_array(\"foo\", array($var)); // works call_user_func_array(\"foo\", array(&$var));
  41. E_DEPRECATED New error level to indicated deprecated stuff scheduled for removal in later releases Part of E_ALL which is good :) E_USER_DEPRECATED for userland errors Should be used for deprecated stuff, so E_STRICT can be used for the intended “bad practice” purpose
  42. Windows Much improved
  43. Bugfixes Some of which are really, really important
  44. - Fixed bug #47757 (rename JPG to JPEG in phpinfo). (Pierre)
  45. Thank You And Goodbye! Johannes Schlüter (johannes@php.net) http://twitter.com/phperror David Zülke (david.zuelke@bitextender.com) http://twitter.com/dzuelke

+ David ZuelkeDavid Zuelke, 6 months ago

custom

973 views, 5 favs, 1 embeds more stats

Part one of the joint presentation with Johannes Sc more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 973
    • 971 on SlideShare
    • 2 from embeds
  • Comments 1
  • Favorites 5
  • Downloads 32
Most viewed embeds
  • 2 views on http://duniarusak.blogspot.com

more

All embeds
  • 2 views on http://duniarusak.blogspot.com

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories