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, a walkthrough

2,844 views

Published on

This talk was given as

  • Be the first to comment

PHP 5.3, a walkthrough

  1. 1. PHP 5.3 A Walkthrough @davidcoallier Dé Luain 20 Meán Fómhair 2010
  2. 2. Who are you? Experiences, usage, etc. Dé Luain 20 Meán Fómhair 2010
  3. 3. Who am I? Work, experiences, usage, etc. Dé Luain 20 Meán Fómhair 2010
  4. 4. The Talk! Recap of why you are here... Dé Luain 20 Meán Fómhair 2010
  5. 5. A small PHP 6 Oh no, you didn’t! Dé Luain 20 Meán Fómhair 2010
  6. 6. In a nutshell mysqlnd, phar, syntax, sqlite3, spl-sauce, speed, etc. Dé Luain 20 Meán Fómhair 2010
  7. 7. ext/intl Internationalization Extension Dé Luain 20 Meán Fómhair 2010
  8. 8. Collator string comparison, sorting, locale Dé Luain 20 Meán Fómhair 2010
  9. 9. Numbers... 1,000,000; 1.000.000; 1 000 000 Dé Luain 20 Meán Fómhair 2010
  10. 10. ICU ☕ ♿⚛ Dé Luain 20 Meán Fómhair 2010
  11. 11. More Importantly Dé Luain 20 Meán Fómhair 2010
  12. 12. LSB Late Static Binding, wtf is that? Dé Luain 20 Meán Fómhair 2010
  13. 13. NAMESPACES Dé Luain 20 Meán Fómhair 2010
  14. 14. NAMESPACES!!!! Dé Luain 20 Meán Fómhair 2010
  15. 15. Closures & λs Dé Luain 20 Meán Fómhair 2010
  16. 16. Late-Static Bindingself:: vs static::, what’s that? LSB? Dé Luain 20 Meán Fómhair 2010
  17. 17. class Base { public static function who() { echo __CLASS__; } public static function foo() { self::who(); } } class Child extends Base { public static function who() { echo __CLASS__; } } Child::foo(); // Echoes Base Dé Luain 20 Meán Fómhair 2010
  18. 18. class Base { public static function who() { echo __CLASS__; } public static function foo() { static::who(); } } class Child extends Base { public static function who() { echo __CLASS__; } } Child::foo(); // Echoes Child Dé Luain 20 Meán Fómhair 2010
  19. 19. $this is not static:: Don’t get tricked, no inheritance Dé Luain 20 Meán Fómhair 2010
  20. 20. Object Lifecycle Create, Immute, Memoize Dé Luain 20 Meán Fómhair 2010
  21. 21. Referencial Transparency It’s not maths, it’s software. Dé Luain 20 Meán Fómhair 2010
  22. 22. ZzzZz..... Dé Luain 20 Meán Fómhair 2010
  23. 23. Dynamic Statics Oh that sounds nasty... Dé Luain 20 Meán Fómhair 2010
  24. 24. $class = 'ClassName'; $method = 'methodName'; $class::$method(...); Dé Luain 20 Meán Fómhair 2010
  25. 25. Remember __call? Dé Luain 20 Meán Fómhair 2010
  26. 26. __callStatic() Dé Luain 20 Meán Fómhair 2010
  27. 27. Enough Statics.. Moving on. Dé Luain 20 Meán Fómhair 2010
  28. 28. Namespaces So we have namespaces, now what? Dé Luain 20 Meán Fómhair 2010
  29. 29. Get over it. We know. Dé Luain 20 Meán Fómhair 2010
  30. 30. Organize Structural decisions, maintainability Dé Luain 20 Meán Fómhair 2010
  31. 31. namespace pearpackage; class Example { // ... } Dé Luain 20 Meán Fómhair 2010
  32. 32. use pearpackage; $class = new Example(); // or $class = new pearpackageExample(); Dé Luain 20 Meán Fómhair 2010
  33. 33. Meaning And community significance Dé Luain 20 Meán Fómhair 2010
  34. 34. The culprit strlen Dé Luain 20 Meán Fómhair 2010
  35. 35. Coding Standards http://groups.google.com/group/php-standards/web/psr-0-final-proposal Dé Luain 20 Meán Fómhair 2010
  36. 36. Phar The jar-like PHP Archives Dé Luain 20 Meán Fómhair 2010
  37. 37. include 'phar://package.phar/index.php'; Dé Luain 20 Meán Fómhair 2010
  38. 38. $phar = new Phar('drupal7.phar'); $phar->buildFromDirectory(__DIR__ . '/drupal7'); $phar->setStub("<?php Phar::interceptFileFuncs(); Phar::webPhar(); __HALT_COMPILER(); ?>" Dé Luain 20 Meán Fómhair 2010
  39. 39. RewriteRule ^(.*)$ /drupal7.phar/$1 [QSA,L] Dé Luain 20 Meán Fómhair 2010
  40. 40. Running, web-ing Phar magic-happy-times. Dé Luain 20 Meán Fómhair 2010
  41. 41. λ (Lambda) Assigned to a variable Dé Luain 20 Meán Fómhair 2010
  42. 42. $name = function() { return 'david'; }; Dé Luain 20 Meán Fómhair 2010
  43. 43. Closure functions with bound variables Dé Luain 20 Meán Fómhair 2010
  44. 44. Sto len Fro m $names = array( NA 'Nate Abele', 'David Coallier', 'Cap'n Crunch' TE ); ! $split = array_map( function($name) { list($first, $last) = explode(' ', $name); return compact('first', 'last'); }, $names ); // Result: array( array('first' => 'Nate', 'last' => 'Abele'), array('first' => 'David', 'last' => 'Coallier'), array('first' => 'Cap'n', 'last' => 'Crunch') ) Dé Luain 20 Meán Fómhair 2010
  45. 45. $names = array('david', 'nate'); $friends = array('helgi', 'joel'); $split = function($name) use ($friends) { //... }; Dé Luain 20 Meán Fómhair 2010
  46. 46. Functors :O Dé Luain 20 Meán Fómhair 2010
  47. 47. class Name { public function __invoke() { return 'david'; } } echo $name(); Dé Luain 20 Meán Fómhair 2010
  48. 48. Other things? SPL, changes, NOWDOCS, etc Dé Luain 20 Meán Fómhair 2010
  49. 49. Fast Ternaries No need to check anymore... Beware Dé Luain 20 Meán Fómhair 2010
  50. 50. $name = isset($_GET['name']) ? $_GET['name'] : 'No Name'; Dé Luain 20 Meán Fómhair 2010
  51. 51. $name = $_GET['name'] ?: 'No Name'; Dé Luain 20 Meán Fómhair 2010
  52. 52. NOWDOCS NOWDOCS cooler than HEREDOCS Dé Luain 20 Meán Fómhair 2010
  53. 53. $name = 'david'; $example =<<<RTFM Hello $name, See you soon. RTFM; // Hello David Dé Luain 20 Meán Fómhair 2010
  54. 54. $name = 'david'; $example =<<<'RTFM' Hello $name, See you soon. RTFM; // Hello $name Dé Luain 20 Meán Fómhair 2010
  55. 55. Performance Better faster strong. Better stack Dé Luain 20 Meán Fómhair 2010
  56. 56. Garbage Collection gc_enable(), gc_disable(), etc. Dé Luain 20 Meán Fómhair 2010
  57. 57. __DIR__ dirname(__FILE__) Dé Luain 20 Meán Fómhair 2010
  58. 58. __NAMESPACE__ Dé Luain 20 Meán Fómhair 2010
  59. 59. namespace pearpackageExample2 { const TEST = 'In Namespaces...'; function foo() { echo __NAMESPACE__; } } echo pearpackageExample2::TEST; // In Namespaces... pearpackageExample2foo(); // Example2 Dé Luain 20 Meán Fómhair 2010
  60. 60. E_DEPRECATED Dé Luain 20 Meán Fómhair 2010
  61. 61. MySQLnd Native MySQL Driver, faster, stats, self-contained Dé Luain 20 Meán Fómhair 2010
  62. 62. DateTime Crazy amazing dates handling Dé Luain 20 Meán Fómhair 2010
  63. 63. $datetime1 = new DateTime('2009-10-11'); $datetime2 = new DateTime('2009-10-13'); $interval = $datetime1->diff($datetime2); echo $interval->format('%R%d days'); // +2 days Dé Luain 20 Meán Fómhair 2010
  64. 64. SPL Iterators, Iterators, Iterators. Dé Luain 20 Meán Fómhair 2010
  65. 65. SPL Datastructures, Exceptions, Misc... Dé Luain 20 Meán Fómhair 2010
  66. 66. My Favourite Dé Luain 20 Meán Fómhair 2010
  67. 67. PHP FPM Alternate FastCGI Implementation 5.3.3 Dé Luain 20 Meán Fómhair 2010
  68. 68. Incentive Why do I have to use PHP 5.3? Dé Luain 20 Meán Fómhair 2010
  69. 69. Lithium It’s so rad! Dé Luain 20 Meán Fómhair 2010
  70. 70. Zend Framework 2 Dé Luain 20 Meán Fómhair 2010
  71. 71. Symfony 2 Dé Luain 20 Meán Fómhair 2010
  72. 72. Doctrine 2 Dé Luain 20 Meán Fómhair 2010
  73. 73. Q&A Dé Luain 20 Meán Fómhair 2010
  74. 74. Thank you @davidcoallier Dé Luain 20 Meán Fómhair 2010

×