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
15. Fileinfo
File mimetype
▹ from magic bytes
▹ not bullet proof
BC to ext/mime_magic
▹ mime_content_type()
Thomas Weinert, papaya Software GmbH 15
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
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
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