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

PHP.net:
PHP 7.3.0 alpha 3 Released
Jul 05, 2018 @ 11:26:10

On the main PHP.net site they've posted an announcement about the release of the latest alpha version of the next major PHP release: PHP 7.3.0 alpha 3.

The PHP team is glad to announce the release of the third PHP 7.3.0 version, PHP 7.3.0 Alpha 3. The rough outline of the PHP 7.3 release cycle is specified in the PHP Wiki.

[...] Please carefully test this version and report any issues found in the bug reporting system. [...] The next release would be Beta 1, planned for July 19th.

This latest release fixed bugs in a wide range of functionality all across the language including PostgreSQL handling, regular expressions, DOM parsing, the intl extension and OpenSSL. You can find complete details in the changes in the NEWS file for this latest release. As with other pre-stable releases, you can download this latest version for testing from the QA site for source packages or the Windows QA site for the Windows binaries.

tagged: language alpha release php73alpha3

Link: http://php.net/index.php#id2018-07-05-1

Sammy Kaye Powers:
Testing Unreleased Features of PHP
Jun 26, 2018 @ 09:31:52

In a new post to his site Sammy Kaye Powers shows you how to test unreleased features of PHP using a pull request related to a RFC that's officially been proposed.

We'll be discovering and testing a completely unreleased feature of php-src from an RFC that's still under discussion.

If you've ever wanted to be ahead of the curve of PHP features or you've just wanted to contribute back to PHP internals, testing an unreleased feature from an RFC is a fun and educational way to do so.

He uses the typed properties RFC in his example (allowing the addition of types to class properties). He then walks through the checkout of the PHP source, grabbing the pull request for the RFC and compiling PHP with the new code in place. He shows an example of a script that makes use of this new feature and tries it out. Finally, he covers how to run tests on this new version and some suggestions on adding typed properties to real-world projects.

tagged: language rfc pullrequest tutorial testing unreleased feature

Link: https://www.sammyk.me/how-to-compile-an-unreleased-rfc-feature-for-php-source-php-internals

PHP.net:
PHP 7.2.7 Released
Jun 22, 2018 @ 10:27:45

The main PHP.net site has released the latest version in the PHP 7.2x series: PHP 7.2.7.

The PHP development team announces the immediate availability of PHP 7.2.7. This is a primarily a bugfix release which includes a segfault fix for opcache.

PHP 7.2 users are encouraged to upgrade to this version.

Besides the segfault fix, the Changelog also lists issues corrected in the CLI server, OpenSSL handling and SPL functionality. As always, you can get this latest release from the main downloads page (source) or from windows.php.net for the Windows binaries.

tagged: language release bugfix php72

Link: http://php.net/index.php#id2018-06-21-2

PHP.net:
PHP 7.3.0 alpha 2 Released
Jun 21, 2018 @ 10:08:28

The main PHP.net site has posted the announcement about the release of the latest alpha for the PHP 7.3.x series: PHP 7.3.0 Alpha 2.

This is a development release and is not intended to be used in production. Several bugs were fixed including issues with:

  • command line output
  • a Mysqlnd truncation problem
  • Opcache
  • date interval handling
  • parsing files in the tokenizer

You can see the full list of changes and related bugs in the NEWS file section for the release. As always, this release can either be downloaded from the main downloads page for source packages or windows.php.net for the Windows binaries. The next release, Alpha 3, is scheduled for July 5th which should be followed by the official branching of 7.3 pre-beta.

tagged: language alpha release php73alpha2

Link: http://php.net/index.php#id2018-06-21-1

Laravel News:
PHP in 2018
Jun 05, 2018 @ 09:31:26

On the Laravel News site, they have a post sharing a video from a presentation by Rasmus Lerdorf (creator of PHP) looking forward at PHP in 2018.

PHP in 2018 is a talk by PHP creator Rasmus Lerdorf, which focuses on new features in PHP 7.2 and 7.3. We have some exciting low-level performance wins coming to PHP 7.3, which should be out late 2018. It’s highly encouraging that PHP’s focus is mainly on performance in the PHP 7.x releases.

For many in the PHP community, 2016 and 2017 was all about getting onto PHP 7. The drastic performance improvements and overall efficiency have resulted in PHP 7 adoption rates well beyond past PHP versions. If you are not on PHP 7 yet, you will learn why you should be, but the talk will focus more on new features in PHP 7.2 and 7.3 along with optimization and static analysis.

In the post, they give a brief summary of the talk and one of their favorite parts ("crappy code runs really really well"). The video of the talk is embedded in the page but you can also watch it on YouTube directly. The slides are here.

tagged: rasmuslerdorf presentation slides video 2018 language

Link: https://laravel-news.com/php-in-2018

Exakat Blog:
The 100 PHP functions that you have to know
May 31, 2018 @ 09:54:33

On the Exakat blog they have a new post with the results from their evaluation of a wide range of PHP applications showing the Top 100 PHP functions in use.

Here is the top 100 PHP functions : it is the list of the most often used PHP native functions.

The functions are named, and ranked from 1 to 100. The other 4500 functions are not ranked now. The frequency column represents how often this function is used across PHP code : the reference corpus is a list of 1900 PHP open source projects. They were audited with Exakat static analysis engine, version 1.2.5. The average is the number of time a function is called within one project. Some function are used in isolation, and others are a staple.

The top 5 on the list are:

Each item on the list comes with "frequency" and "average" scores (that mostly relate directly). Check out the post for the full list and a list of some insights they worked up as they generated the listing.

tagged: top100 list function language ranking usage

Link: https://www.exakat.io/top-100-php-functions/

PHP.net:
PHP 7.1.18 Release
May 28, 2018 @ 11:26:01

The official PHP.net site has posted an announcement about the latest release in the PHP 7.1.x series: PHP 7.1.18.

The PHP development team announces the immediate availability of PHP 7.1.18. All PHP 7.1 users are encouraged to upgrade to this version.

A few bugs were fixed in this release including issues in FPM handling, internationalization functionality and Opcache. You can see the full changelog here and, as always, download the latest version either from the main downloads page or windows.php.net for the Windows binaries.

tagged: language release bugfix php71

Link: http://php.net/index.php#id2018-05-25-1

Joe Watkins:
PHP allows for the design of X
May 23, 2018 @ 11:20:33

Joe Watkins has a new post to his site that provides his opinions about answering the people that say "PHP wasn't designed for X".

Starting complicated twitter conversations should be avoided, I know this, and yet blurted this out on twitter recently...

This was met with a flurry of responses and I couldn't reasonably reply in tweet form. I'm going to respond to some of those tweets (indirectly) and further explain my original tweet.

He starts off by talking about how PHP isn't always the right tool for a certain job (some people's misinterpretation of his tweet). He also talks about why PHP isn't a "templating language" and has evolved so much beyond some of its original roots. He ends the post responding to the original comment, that "PHP wasn't designed for X". He talks about the opinions of those not as familiar with the current state of the language and, when they say "just because you can, doesn't mean you should" (meaning that they think you actually shouldn't).

When support emerges for a new problem domain, let's be pragmatic and observe that expanding the horizons of PHP in any direction is good for the community that relies on PHP (and maybe PHP alone) to make a living. Let's not rush to take new solutions to production tomorrow, but let's not dismiss anything out of hand because of some imaginary short coming in PHP.
tagged: opinion language design feature improvement

Link: http://blog.krakjoe.ninja/2018/05/php-allows-for-design-of-x.html

Freek van Der Herten:
When empty is not empty
May 21, 2018 @ 09:38:08

As PHP developers, dealing with the "helpful" automatic type shifting the language performs can sometimes be challenging. It can lead to some interesting situations like the one Freek van Der Herten has posted about where something that seems "empty" actually isn't.

Recently when I was working on a project I got some strange results when using the empty function. That's really odd [that the result was a string and "empty" when a value was set]. How can a variable hold a string and be empty at the same time?

He includes a few other tests on the same object and firstName property using other "empty" checks with isset and is_null. Those behaved as expected so he started to look more into the class the object is based on. In the class values/properties are returned via magic methods, not direct functions. In the case of empty, this fetching isn't interpreted prior to the check and the result appears "empty". To fix the issue, he recommends implementing an __isset magic method that will then get called to ensure the value is actually set before fetching it.

tagged: language isset empty property tutorial

Link: https://murze.be/when-empty-is-not-empty

Exakat Blog:
Weird operators in PHP
May 18, 2018 @ 09:56:29

On the Exakat blog there's a new post sharing some of the weird operators in PHP that you may have not known existed. These are ones outside of the normal = or . that can really do some odd things.

If you read the PHP documentation, you will learn about a ton of operators. If you haven’t learnt about PHP operators, go do that first, we’ll wait for you.

Operators are usually made up with strange symbols, like !, -, =>, <=>, ^ or ~. Really, some are plain readable like and, while some are merely an missed attempt at being readable, and actually hide a double personnality, like xor.

You probably think you know PHP’s documentation in and out, but there is always more to learn. So I dove deep into the core of PHP code, and looked some special PHP operators that are lesser known, but very useful in your daily coding.

There's ten of the odd operators on their list including:

  • the "b" operator for strings
  • the "left object" operator
  • constant names with * and %

Check out the full post for the details (and code examples) on each of these and more.

tagged: weird operator list language example

Link: https://www.exakat.io/weird-operators-in-php/