Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

HHVM Blog:
Improving Arrays in Hack
Nov 03, 2015 @ 11:46:14

On the HHVM blog there's a post talking about some of the updates they've made with array handling in Hack to help make it more efficient and overcoming some of the challenges in how they're being used.

Arrays are the ubiquitous data structure in PHP, used to represent everything from lists, associated lists, sets, tuples, or even a bag of data. This flexibility itself makes it challenging for Hack to understand how an array will be used. [...] If this was the only problem with PHP arrays, then the solution would be “simple”; make the type checker smarter (something we are working on). However there are a number of other semantic details around arrays that are nearly impossible to analyze statically.

They talk about some of the issues a bit more specifically including:

  • indexing of non-existent keys
  • key coercion
  • arrays containing references

They also talk about some of the legitimate use cases for arrays over the collections Hack offers, mostly do to with the values they could contain. The post ends with links to some of the other future improvements to the array handling in Hack and a look further out and their vision of replacing PHP arrays with Hack arrays and moving collections to a runtime library.

tagged: hhvm hack array improvement problem values collections

Link: http://hhvm.com/blog/10649/improving-arrays-in-hack

Julien Pauli:
Huge Page usage in PHP 7
Oct 30, 2015 @ 12:16:48

In this post to his site Julien Pauli looks at the concept of "huge pages" and how it relates to some of the behind the scenes work done in PHP 7 to improve memory usage.

Memory paging is a way Operating Systems manage userland process memory. Each process memory access is virtual, and the OS together with the hardware MMU must translate that address into a physical address used to access the data in main memory (RAM).

Paging memory is dividing memory in chunks of fixed size, called pages. [...] Why use huge pages? The concept is easy. If we make the OS Kernel use bigger page sizes, that means that more data can be accessed into one single page. That also means that we'll suffer from less TLB miss, once the page translation is stored into the TLB, because one translation will now be valid for more data.

He briefly covers how some updated memory handling and opcode restructuring helps PHP 7 perform even better, especially when it comes to the OPCache handling. He talks about the changes made in the extension specifically to support the "huge pages" idea, complete with code examples (in C) of how this was accomplished.

tagged: huge page php7 memory improvement performance opcache

Link: http://jpauli.github.io/2015/10/28/huge-page.html

Zend Developer Zone:
PHP 7 Quick Overview
Sep 21, 2015 @ 13:51:26

On the Zend Developer Zone they've posted an article talking about the upcoming major version of PHP, PHP 7, and what you can expect from it. It's a brief overview of the new features and functionality included in this big update.

PHP7 is around the corner. According to the wiki time table if everything goes well, it is expected to be released in November 2015. Many of us are excited to learn the language level features and it’s performance.

The article touches on the highlights of:

  • Performance boosts
  • Null Coalesce Operator
  • Scalar Type Hints
  • Weak type mode
  • Strict mode
  • Handling Exceptions
  • Return Type Declaration
  • Reserve More Types in PHP 7
  • Timezone warning

There's a lot of new things coming, so check out this guide for a quick overview and to get up to speed before it's here.

tagged: php7 overview introduction list feature improvement

Link: http://devzone.zend.com/6656/php-7-quick-overview/

Andrew Smith:
Why is Slim 3 not so slim anymore
Aug 03, 2015 @ 09:54:13

In this post to is site Andrew Smith refutes the misconception that version three (v3) of the Slim PHP microframework is "not so slim" anymore with some of the additions to this latest version, increasing it's size and complexity.

There is a common misconception that Slim 3 has plenty of files and is no longer slim. Slim 3 does indeed contain more files than Slim 2 and this has been the result of being more flexible and moving away from the Not Invented Here (NIH) philosophy.

Installing Slim 3 through composer will install all its dependencies, when doing a PHP file count you will notice we have doubled in file count. This is a given with the amount of flexibility we now have. Most developers might not see any benefit in this as they will likely just work with what is provided, but if at any point you should hit a limitation in any working part of the framework, you can easily swap it out without a fuss.

He includes the command to install this latest version via Composer and how to count the number of files with a single command. He points out that some people that are reporting 1000+ PHP files being installed with the framework are probably getting the development packages as well and not just the release. He points out that "Slim 3 is still slim, we just added more flexibility in it." He ends the post with a thanks to Josh Lockhart and a few others who have made large contributions to the project and have helped make it what it is.

tagged: slimframework version slim3 slim2 size improvement flexibility

Link: http://thoughts.silentworks.co.uk/why-is-slim3-not-so-slim-anymore/

HHVM Blog:
Lockdown Results and HHVM Performance
Jun 10, 2015 @ 09:02:59

The HHVM blog has a new post today sharing the results of their first open source lockdown. During this time they worked to improve not only HHVM itself but how well it supports other open source projects using it as a platform.

The HHVM team has concluded its first ever open source performance lockdown, and we’re very excited to share the results with you. During our two week lockdown, we’ve made strides optimizing builtin functions, dynamic properties, string concatenation, and the file cache. In addition to improving HHVM, we also looked for places in the open source frameworks where we could contribute patches that would benefit all engines. Our efforts centered around maximizing requests per second (RPS) with WordPress, Drupal 7, and MediaWiki, using our oss-performance benchmarking tool.

They share some of the benchmark improvements made by the updates during the session including performance boosts for WordPress & MediaWiki. They also talk about the community involvement during the event and updates made to their own tooling too. The post then spends some time talking about their methodology on development and testing during the lockdown and how the results compare pre- and post-lockdown. The remainder of the post looks at some more specific issues and covers a few technical notes about software used and how the results were reported.

tagged: hhvm lockdown opensource benchmark improvement wordpress drupal mediawiki results

Link: http://hhvm.com/blog/9293/lockdown-results-and-hhvm-performance

Derick Rethans:
Xdebug 2.3: Improvements to Tracing
Mar 31, 2015 @ 11:15:33

Derick Rethans has posted a new article in his series highlighting some of the changes in the latest release of Xdebug (v2.3). In this new post he talks about some of the improvements in the trace file functionality.

Trace files are a way to document every function call, and if you enable it, variable assignment and function's return values — including when these functions were called, and how much memory PHP was using at the moment of function entry (and exit). Xdebug 2.3 adds a new type of parameter rendering for stack traces and function traces through the xdebug.collect_params setting.

This new setting allows much more information to be reported back in the trace results, adding on a serialized version of the value of variables. He also shows the output results (human-readable) that shows the memory usage and time index for the execution. He also shows the new handling to include return values in the trace output using the "xdebug.trace_format" handling.

tagged: tracing improvement xdebug release series part5 output

Link: http://derickrethans.nl/xdebug-2.3-tracing-improvements.html

Derick Rethans:
Xdebug 2.3: Improvements to Debugging
Mar 25, 2015 @ 09:13:34

In the latest in his series covering some of the improvements in the latest Xdebug release, Derick Rethans has posted this new article detailing some of the performance enhancements related to remote debugging that come with this new version.

This is the fourth article in a series about new features in Xdebug 2.3, which was first released on February 22nd. In this article we are looking at the improvements towards "remote" debugging.

The updates include showing the values of user-defined constants, being able to set an exception breakpoint on all exceptions and additional features around debugging the exceptions themselves. The output now includes the exception's error code and which exception the flow was broken on (though in his example of PHPStorm, the IDE won't report that information back). The last change he mentions is a change that reverts the output to a log if it can't write to a socket (usually SELinux related).

tagged: xdebug performance improvement remote debugging version release

Link: http://derickrethans.nl/xdebug-2.3-debugging-improvements.html

Derick Rethans:
Xdebug 2.3: Moar var_dump()
Feb 27, 2015 @ 09:58:40

Derick Rethans has a new post to his site starting a series of posts about the new features of Xdebug 2.3. In this new post he talks about an improvement that's been made to the output provided by var_dump with more information than before.

One of the new features relates to one of the first things that I added in the original Xdebug: making the var_dump() output "pretty". Xdebug replaces PHP's standard var_dump() function with its own version, as long as the xdebug.overload_var_dump setting is not set to 0. [...] Xdebug 2.3 enhances the overloading of var_dump() with the inclusion of the file name and line number where var_dump() is called at. This has been a long standing feature request.

He provides a few sample screenshots comparing the old and new output formats and mentions another handy setting, xdebug.file_link_format, that makes the resulting filename a link in a browser and lets you customize the format.

tagged: xdebug vardump overload file path information output improvement release

Link: http://derickrethans.nl/xdebug-2.3-overload-vardump.html

SitePoint PHP Blog:
Exploring the Cache API in Drupal 8
Feb 26, 2015 @ 11:41:45

On the SitePoint PHP blog today there's a new tutorial (by Daniel Sipos) talking about the Drupal 8 cache and showing how to use it in an example, caching the latest post data pulled from the Drupal content.

Drupal 8 comes with many improvements over its predecessor we have grown to both love and hate. Next to prominent systems such as Views in core, configuration management or a useful translation service, there are also less known changes but that are equally important to know and use. One such improvement has been the cache API that solves many performance problems we have in Drupal 7.

They start with a basic introduction to the new cache handing and how the caches are separated out into different "bins" rather than all stored in one place. He includes sample code showing how to: save data to the cache, getting information back out and invalidating the cache to be handled by garbage collection. He also covers the cache tags, a feature that allows you to "tag" items across multiple caches and remove/invalidate them all at the same time. He wraps up the post getting into the more practical example showing the caching at work in a controller caching the contents of the posts to the Drupal site.

tagged: drupal cache drupal8 tutorial introduction improvement

Link: http://www.sitepoint.com/exploring-cache-api-drupal-8/

What changes would you like to see in PHP 7?
Jan 20, 2015 @ 12:51:08

In the /r/php subreddit on Reddit.com a question was posed to the community: What changes would you like to see in PHP 7?. So far there's 80+ answers with a wide variety of responses.

As well as massive performance improvements, PHP 7's change / feature list is already looking great. You can find most of the features that have been accepted or are under discussion on the PHP Dev Wiki: RFCs section. But what changes would make a difference to you? What would you really like to see make it in (already suggested or a new suggestion)?

Here's just a few of the suggestions made by fellow Reddit users:

  • fixing inconsistencies in naming
  • sandboxed eval
  • a complete rework of the standard library
  • the introduction of generics
  • adding enum functionality
  • type aliasing
  • stack traces for fatal errors

Check out the full post for more ideas and feedback from other members of the community too. It's an interesting list of suggestions, some that are even already in the works.

tagged: php7 changes reddit opinion community language feature improvement

Link: http://www.reddit.com/r/PHP/comments/2sx5x3/what_changes_would_you_like_to_see_in_php_7/