PHP 5.4 - So what?!

3,284 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,284
On SlideShare
0
From Embeds
0
Number of Embeds
1,050
Actions
Shares
0
Downloads
17
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PHP 5.4 - So what?!

  1. 1. PHP 5.4So what?!
  2. 2. Always prefer the english manual!
  3. 3. Backward Incompatible Changes
  4. 4. Safe mode is no longer supported
  5. 5. Magic quotes has been removed.
  6. 6. The register_globals andregister_long_arrays ini directives have been removed.
  7. 7. Call-time pass by reference has been removed.
  8. 8. The break and continue statements no longer accept variable arguments.
  9. 9. In the date and time extension, thetimezone can no longer be set using the TZ environment variable.
  10. 10. Non-numeric string offsets - e.g.$a[foo] where $a is a string - now return false on isset() and true onempty(), and produce a warning if you try to use them.
  11. 11. Converting an array to a string will now generate an E_NOTICE level error
  12. 12. The default character set is now UTF-8, instead of ISO-8859-1
  13. 13. New Reserved Keywords• trait• callable• insteadof
  14. 14. New Features
  15. 15. Traits
  16. 16. Short array syntax• $a = [1, 2, 3, 4];• $a = [one => 1, two => 2, three => 3, 4];
  17. 17. Function array dereferencing• foo()[0]
  18. 18. Closures now support $this
  19. 19. <?= is now always available,regardless of the short_open_tag ini option.
  20. 20. Class member access on instantiation has been added• (new Foo)->bar()
  21. 21. 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
  22. 22. Built-in web server in CLI mode• php -S localhost:8000 -t foo/• C:UsersfuhrDownloadsphp-5.4.0-Win32- VC9-x86>.php -c php.ini-development -S localhost:8181 -t Usersfuhrworkspacephp54src
  23. 23. Changed Functions
  24. 24. 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 ]] )
  25. 25. New Classes and Interfaces
  26. 26. JsonSerializable
  27. 27. SessionHandler &SessionHandlerInterface
  28. 28. CallbackFilterIterator &RecursiveCallbackFilterIterator
  29. 29. New Methods
  30. 30. 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()
  31. 31. 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/

×