PHP 5.3/6

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    PHP 5.3/6 - Presentation Transcript

    1. PHP 5.3/6 Standortbestimmung
    2. About me  Application Developer ▹ PHP ▹ XSLT/XPath ▹ (some) Javascript  papaya CMS ▹ PHP based Content Management System ▹ uses XSLT for Templates Thomas Weinert, papaya Software GmbH 2
    3. PHP 5.3 „PHP 5.3 is still young“ Thomas Weinert, papaya Software GmbH 3
    4. PHP 5.3 Thomas Weinert, papaya Software GmbH 4
    5. PHP 6 „PHP 6 is already in development“ Thomas Weinert, papaya Software GmbH 5
    6. PHP 6 … for some years ... Thomas Weinert, papaya Software GmbH 6
    7. PHP 5.3 What do we get? Thomas Weinert, papaya Software GmbH 7
    8. Bugfixes All Closed Open Critical Verified Analyzed 13085 4007(199) 919 (50) 2 11 2 Assigned Suspended Feedback No Wont fix Bogus Feedback 261 26 45 1651 350 5806 Thomas Weinert, papaya Software GmbH 8
    9. Performance Performance about 5 – 15% or more? Thomas Weinert, papaya Software GmbH 9
    10. Garbage Collection  gc_enable() ▹ Activates the circular reference collector  gc_collect_cycles() ▹ Forces collection of any existing garbage cycles.  gc_disable()  gc_enabled() Thomas Weinert, papaya Software GmbH 10
    11. PHP.INI  per directory (like .htaccess) ▹ Cached  [PATH=/opt/httpd/www.example.com/]  [HOST=www.example.com]   Ini „variables“  absolute paths for extensions Thomas Weinert, papaya Software GmbH 11
    12. Extensions Changed  PCRE, Reflection, SPL ▹ can not be disabled any more  MySQL(i) ▹ mysqlnd  SQLite ▹ SQLite 3 Support  GD ▹ removed GD1 and Freetype1 support Thomas Weinert, papaya Software GmbH 12
    13. Extensions Moved  Moved to PECL ▹ fdf ▹ ncurses ▹ sybase ▹ ming ▹ dbase ▹ fbsql ▹ mime_magic Thomas Weinert, papaya Software GmbH 13
    14. Extensions Added  fileinfo  intl  phar Thomas Weinert, papaya Software GmbH 14
    15. Fileinfo  File mimetype ▹ from magic bytes ▹ not bullet proof  BC to ext/mime_magic ▹ mime_content_type() Thomas Weinert, papaya Software GmbH 15
    16. Fileinfo Sample <?php $finfo = finfo_open(FILEINFO_MIME); foreach (glob(\"*\") as $filename) { echo finfo_file($finfo, $filename) . \"\\n\"; } finfo_close($finfo); ?> Thomas Weinert, papaya Software GmbH 16
    17. INTL  ICU ▹ International Components for Unicode  Internationalization ▹ String functions ▹ Collator ▹ Number Formatter ▹ Message Formatter ▹ Normalizer ▹ Locale Thomas Weinert, papaya Software GmbH 17
    18. PHAR  PHP applications in one package  easy distribution and installation  verify archive integrity  PHP stream wrapper  tar and zip  Phar format with stub <?php include 'phar:///path/to/myphar.phar/file.php'; ?> Weinert, papaya Software GmbH Thomas 18
    19. PHAR  Using a stub  Makes a PHAR file a PHP script <?php Phar::webPhar(); __HALT_COMPILER();  http://www.domain.tld/app.phar/page.php Thomas Weinert, papaya Software GmbH 19
    20. SPL  Now always enabled  many iterators and recursive iterators  SPLFixedArray  http://www.php.net/spl Thomas Weinert, papaya Software GmbH 20
    21. Error Reporting  E_DEPRECATED splitted from E_STRICT  E_DEPRECATED included in E_ALL  is_a() is not in E_DEPRECATED any more ▹ but documentation still says it is Thomas Weinert, papaya Software GmbH 21
    22. Syntax Sugar  __DIR__ replaces dirname(__FILE__)  ?: ▹ $foo = $bar ?: 'default'  Nowdoc ▹ $foo = <<<'HTML' // no variables parsed  Heredoc ▹ double quotes ▹ static $foo = <<<HTML // no variables allowed Thomas Weinert, papaya Software GmbH 22
    23. Static  Late Static Binding  __callStatic  static::foo Thomas Weinert, papaya Software GmbH 23
    24. LSB - Why <?php class bar { public function show() { var_dump(new self); } } class foo extends bar { public function test() { parent::show(); } } $foo = new foo; $foo->test(); ?> object(bar)#2 (0) { } Thomas Weinert, papaya Software GmbH 24
    25. LSB - Why <?php class bar { public function show() { var_dump(new static); } } class foo extends bar { public function test() { parent::show(); } } $foo = new foo; $foo->test(); ?> object(foo)#2 (0) { } Thomas Weinert, papaya Software GmbH 25
    26. Dynamic Static Calls <?php class foo { function bar() { var_dump('Hello World'); } } foo::bar(); $o = new foo(); $o::bar(); $s = 'foo'; $s::bar(); ?> Thomas Weinert, papaya Software GmbH 26
    27. Lambda Functions <?php header('Content-type: text/plain'); $text = '<b>Hello <i>World</i></b>'; $ptn = '(<(/?)(\\w+)([^>]*)>)'; $cb = function($m) { if (strtolower($m[2]) == 'b') { return '<'.$m[1].'strong'.$m[3].'>'; } return ''; }; echo preg_replace_callback($ptn, $cb, $text); ?> Thomas Weinert, papaya Software GmbH 27
    28. Closures ... $repl = array( 'b' => 'strong', 'i' => 'em' ); $cb = function ($m) use ($repl) { $tag = strtolower($m[2]); if (!empty($replace[$tag])) { return '<'.$m[1].$repl[$tag].$m[3].'>'; } return ''; }; echo preg_replace_callback($ptn, $cb, $t); ?> Thomas Weinert, papaya Software GmbH 28
    29. Currying function curry($callback) { $args = func_get_args(); array_shift($args); return function() use ($callback, $args) { $args = array_merge( func_get_args(), $args ); return call_user_func_array( $callback, $args ); }; } Thomas Weinert, papaya Software GmbH 29
    30. Currying $cb = curry(array('replace', 'tags'), $replace); echo preg_replace_callback( $pattern, $cb, $text ); class replace { function tags($m, $repl) { $tag = strtolower($m[2]); if (!empty($repl[$tag])) { return '<'.$m[1].$repl[$tag].$m[3].'>'; } return ''; } } Thomas Weinert, papaya Software GmbH 30
    31. Namespaces  Encapsulation ▹ Classes ▹ Functions ▹ Constants  __NAMESPACE__  Overload classes Thomas Weinert, papaya Software GmbH 31
    32. Namespace Separator  Old  Current ▹ Double Colon ▹ Backslash? ▹ Paamayim ▹ Discussion started Nekudotayim :: \\ Thomas Weinert, papaya Software GmbH 32
    33. Namespaces: Classes <?php namespace carica::core::strings; const CHARSET = 'utf-8'; class escape { public static function forXML($content) { return htmlspecialchars( $content, ENT_QUOTES, CHARSET ); } } ?> Thomas Weinert, papaya Software GmbH 33
    34. Use Namespaces ... namespace carica::frontend; use carica::core::strings as strings; ... public function execute() { echo strings::escape::forXML( 'Hello World' ); } ... Thomas Weinert, papaya Software GmbH 34
    35. Namespaces: Constants  PHP-Wiki: ▹ constants are case-sensitive, but namespaces are case-insensitive. ▹ defined() is not aware of namespace aliases. ▹ the namespace part of constants defined with const are lowercased. Thomas Weinert, papaya Software GmbH 35
    36. GOTO <?php goto a; print 'Foo'; a: print 'Bar'; ?> Thomas Weinert, papaya Software GmbH 36
    37. PHP 6  „Backports“ to PHP 5.3  Upload progress in session  Unicode ▹ PHP Source ▹ Functions ▹ Resources Thomas Weinert, papaya Software GmbH 37
    38. Links  Slides ▹ http://www.abasketfulofpapayas.de  PHP 5.3 upgrading notes ▹ http://wiki.php.net/doc/scratchpad/upgrade/53  PHP 5.3 ToDo ▹ http://wiki.php.net/todo/php53  PHP 6 ToDo ▹ http://wiki.php.net/todo/php60 Thomas Weinert, papaya Software GmbH 38

    + Thomas WeinertThomas Weinert, 2 years ago

    custom

    680 views, 0 favs, 4 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 680
      • 628 on SlideShare
      • 52 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 12
    Most viewed embeds
    • 40 views on http://www.abasketfulofpapayas.de
    • 9 views on http://www.a-basketful-of-papayas.net
    • 2 views on http://www.planet-php.net
    • 1 views on http://192.168.10.100

    more

    All embeds
    • 40 views on http://www.abasketfulofpapayas.de
    • 9 views on http://www.a-basketful-of-papayas.net
    • 2 views on http://www.planet-php.net
    • 1 views on http://192.168.10.100

    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

    Tags