Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^52) CHAPTER 5 ■ WHAT'S NEW IN PHP 6
$xml->endElement(); //body
$xml->endElement(); //html
$xml->endDocument();
$xml->flush();
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">




An example XHTML document.


Hello, World!


This paragraph contains an inline
link.




Just the Facts


This chapter started with a guide for installing a preview release of PHP 6 from source, and then
covered some of the upcoming features scheduled for PHP 6.
A major change in PHP 6 is Unicode support. This includes unicode.semantics, a new Unicode
string type, and the ability to convert between traditional binary and Unicode strings. You can
also sort Unicode-encoded arrays according to a localized collation.
PHP 6’s namespaces can help you create a program hierarchy within your class libraries.
Namespaces are created with the namespace statement. The use statement allows you to alias a
specific namespace.
Late static binding expands PHP’s inheritance capabilities. You can use the static scope to
access a value overridden in a descendant class. The get_called_class() method enables you
to create context-aware methods in base classes. Additionally, in PHP 6, a new magic method,
__callStatic(), allows you to create dynamic static functions within your classes.
The ifsetor syntax for the ternary operator in PHP 6 enables a new shorthand format for
ternary assignments.
The new XMLWriter class simplifies XML document creation.
Keep in mind that this chapter was written based on preview information about PHP 6,
which is subject to change. You can access errata about this chapter in the Book Extras section
on the web page for this book on the Apress web site (http://www.apress.com/book/view/
1590598199 ). You can also find more details about PHP version information by referring to the
PHP changelog.

McArthur_819-9C05.fm Page 52 Wednesday, February 27, 2008 8:38 AM

Free download pdf