31
PHP 5.4 So what?!

PHP 5.4 - So what?!

  • Upload
    flagbit

  • View
    2.941

  • Download
    1

Embed Size (px)

Citation preview

Page 1: PHP 5.4 - So what?!

PHP 5.4

So what?!

Page 2: PHP 5.4 - So what?!

Always prefer the english manual!

Page 3: PHP 5.4 - So what?!

Backward Incompatible Changes

Page 4: PHP 5.4 - So what?!

Safe mode is no longer supported

Page 5: PHP 5.4 - So what?!

Magic quotes has been removed.

Page 6: PHP 5.4 - So what?!

The register_globals and register_long_arrays ini directives

have been removed.

Page 7: PHP 5.4 - So what?!

Call-time pass by reference has been removed.

Page 8: PHP 5.4 - So what?!

The break and continue statements no longer accept variable

arguments.

Page 9: PHP 5.4 - So what?!

In the date and time extension, the timezone can no longer be set using

the TZ environment variable.

Page 10: PHP 5.4 - So what?!

Non-numeric string offsets - e.g. $a['foo'] where $a is a string - now return false on isset() and true on empty(), and produce a warning if

you try to use them.

Page 11: PHP 5.4 - So what?!

Converting an array to a string will now generate an E_NOTICE level

error

Page 12: PHP 5.4 - So what?!

The default character set is now UTF-8, instead of ISO-8859-1

Page 13: PHP 5.4 - So what?!

New Reserved Keywords

• trait

• callable

• insteadof

Page 14: PHP 5.4 - So what?!

New Features

Page 15: PHP 5.4 - So what?!

Traits

Page 16: PHP 5.4 - So what?!

Short array syntax

• $a = [1, 2, 3, 4];

• $a = ['one' => 1, 'two' => 2, 'three' => 3, 4];

Page 17: PHP 5.4 - So what?!

Function array dereferencing

• foo()[0]

Page 18: PHP 5.4 - So what?!

Closures now support $this

Page 19: PHP 5.4 - So what?!

<?= is now always available, regardless of the short_open_tag ini

option.

Page 20: PHP 5.4 - So what?!

Class member access on instantiation has been added

• (new Foo)->bar()

Page 21: PHP 5.4 - So what?!

Session Upload Progress

• Session extension can now track the upload progress of files.

• ini settings – session.upload_progress.enabled = true

– session.upload_progress.cleanup = true

– session.upload_progress.prefix = "upload_progress_ "

– session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS "

– session.upload_progress.freq = "1%"

– session.upload_progress.min-freq = 1

Page 22: PHP 5.4 - So what?!

Built-in web server in CLI mode

• php -S localhost:8000 -t foo/

• C:\Users\fuhr\Downloads\php-5.4.0-Win32-VC9-x86>.\php -c php.ini-development -S localhost:8181 -t \Users\fuhr\workspace\php54\src

Page 23: PHP 5.4 - So what?!

Changed Functions

Page 24: PHP 5.4 - So what?!

Stack Frame Limit

• array debug_backtrace ([ int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT [, int $limit = 0 ]] )

• void debug_print_backtrace ([ int $options = 0 [, int $limit = 0 ]] )

Page 25: PHP 5.4 - So what?!

New Classes and Interfaces

Page 26: PHP 5.4 - So what?!

JsonSerializable

Page 27: PHP 5.4 - So what?!

SessionHandler & SessionHandlerInterface

Page 28: PHP 5.4 - So what?!

CallbackFilterIterator & RecursiveCallbackFilterIterator

Page 29: PHP 5.4 - So what?!

New Methods

Page 30: PHP 5.4 - So what?!

SPL

• RegexIterator::getRegex() • SplObjectStorage::getHash() • DirectoryIterator::getExtension() • SplDoublyLinkedList::serialize() • SplDoublyLinkedList::unserialize() • SplFileInfo::getExtension() • SplFileObject::fputcsv() • SplQueue::serialize() • SplQueue::unserialize() • SplStack::serialize() • SplStack::unserialize() • SplTempFileObject::fputcsv()

Page 31: PHP 5.4 - So what?!

Further Reading

• http://www.php.net/manual/en/migration54.php

• http://css.dzone.com/articles/writing-clean-code-php-54

• http://net.tutsplus.com/tutorials/php/php-5-4-is-here-what-you-must-know/