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

Tomas Votruba:
What's New in PHP 7.3 in 30 Seconds in Diffs
Aug 17, 2018 @ 11:13:30

Tomas Vortuba has put together a post sharing a summary of what's new in PHP 7.3 using a bit different tactic than just descriptions: via diffs (in about 30 seconds).

No time but eager to hear PHP news? PHP 7.3 is out in December 2018 and it brings 173 changes. Which are the most useful ones?

For each item in his list he provides code snippets showing the change for:

  • Comma After the Last Argument
  • First and Last Array Key
  • Countable for Risky Variables
  • Safer JSON Parsing

Each item on the list also links over to the related RFC for the feature that provides more detail on the change.

tagged: php73 diff difference feature comma arraykey countable json tutorial

Link: https://www.tomasvotruba.cz/blog/2018/08/16/whats-new-in-php-73-in-30-seconds-in-diffs/

Matt Sparks:
I Want Scalar Objects in PHP
Jul 18, 2018 @ 14:16:09

Matt Sparks has an interesting post to his site sharing something he'd like to see in PHP 8 (quite a ways off in the future but still worth thinking about): scalar objects.

Recently, I read an interesting article from Andrew Carter entitled Make PHP Great Again [cheap plug: this link was included in my most recent Newsletter]. In it Andrew brought up the topic of scalar objects. If you’re not familiar with scalar objects, they represent a single value (integer, boolean, string, etc.) that you can perform operations on*.

He shares an example of what it might look like in PHP and his response to a tweet from Nikola Posa about what features they'd like to see. He then spends the remainder of the post making his case for the inclusion of scalar objects and how it can help clean up some of PHP's own naming and functional inconsistencies.

tagged: scalar object language feature opinion

Link: https://developmentmatt.com/i-want-scalar-objects-in-php/

Laravel News:
New Outer Array Functions Coming to PHP 7.3
Jul 18, 2018 @ 12:47:44

On the Laravel News site they've shown a spotlight on a new feature that's coming with the next major release of the PHP language (v7.3): outer array functions.

PHP 7.3 introduces two new array functions for working with the “outer” keys of an array. The RFC proposal included four new functions for both keys and values, but only the array key functions were accepted: array_key_first() and array_key_last().

[...] Although the outer array value functions were declined, at least new functions will be available for getting the outer keys of an array.

They then provide some code examples of this new functionality, showing how use these new functions to extract values. It also includes examples of the two functions - array_value_first and array_value_last - that were rejected from the RFC when voting happened.

tagged: array outer function php73 feature key value

Link: https://laravel-news.com/outer-array-functions-php-7-3

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

Laravel News:
PHP 7.3: Trailing Commas in Function Calls
Jun 15, 2018 @ 10:46:51

In a post in the Laravel News site, they quickly cover one of the many changes coming with the next jump in versions of the PHP language (v7.3): trailing commas in function calls.

Well PHP 7.3 won’t have arrow functions (that would be dreamy). However, trailing commas in function calls is an excellent addition coming to PHP 7.3.

In PHP 7.3, trailing commas in function calls will be valid syntax. That is to say, you can use trailing commas when calling functions, but not defining them.

They then include two places where these trailing commas could be useful: in the use of variadic functions and in PHP array definitions. The remainder of the post shows the concept of "trailing commas" in other languages including Javascript, Python, and Haskell. The first alpha release of PHP 7.3 has been released if you'd like to try this out with your own code.

tagged: trailing comma function call php73 feature alpha tutorial

Link: https://laravel-news.com/php-trailing-commas-functions

Laravel News:
PHP 7.3: A Look at JSON Error Handling
Jun 13, 2018 @ 10:18:53

On the Laravel News site there's a tutorial posted looking ahead at PHP 7.3 and some of the changes coming for JSON error handling.

One of the new features coming to PHP 7.3 is better error handling for json_encode() and json_decode(). The RFC was unanimously accepted by a 23 to 0 vote. Let’s take a look at how we handle JSON errors in <= PHP 7.2, and the new improvements coming in PHP 7.3.

They start with an example of how PHP developers would normally check for JSON parsing errors and the typical response when it fails. In the proposed functionality for PHP 7.3 and optional JSON_THROW_ON_ERROR would be added to throw a JsonException if there was an issue parsing the provided data. This also means that you no longer need to manually request the error message, it would just come through as a part of the standard exception. You can find out the full details on the change in the RFC.

tagged: php73 json parse error handling throwable exception feature rfc

Link: https://laravel-news.com/php-7-3-json-error-handling

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

Laravel News:
Laracasts: What’s New in Laravel 5.6
May 02, 2018 @ 11:54:59

On the Laravel News site they've posted information about a series of videos on the Laracasts site covering what's new in Laravel 5.6.

Laravel 5.6 has been for a few weeks now and it includes a few nice new features like Broadcast Channel Classes, Collision Reporting, Improved Logging, and more.

In order to get you up to speed on all these new features, Laracasts has started a new free series, “What’s new in Laravel 5.6” that will go through each major feature of this release.

The series includes videos covering how they upgraded the Laracasts' codebase to 5.6, collision reporting, logging improvements and dynamic rate limiting. More videos will be added to the series as it goes along. You can check out the current listing of videos on the Laracasts site.

tagged: laravel release feature laravel56 video laracast series

Link: https://laravel-news.com/laracasts-whats-new-in-laravel-5-6

Symfony Finland:
MySQL 8.0 released with new features and improved performance
Apr 25, 2018 @ 11:57:45

On the Symfony Finland site they cover a recent announcement from MySQL about the release of their latest version: MySQL 8.0. In this post they cover some of the new features and performance improvements that come with this new version.

The MySQL development team has announced the General Availability of the MySQL 8.0.0 Open Source database.

This is the version following MySQL 5.7 that was released in late 2015 with interesting features like extensive JSON field support. Plenty of work has gone into this version as well and in an introductory post goes in-depth into all the enhancements.

The post includes a listing of eight topics (ironically) for the new updates including:

  • Support for Window functions, Common Table Expressions, NOWAIT and SKIP LOCKED, Descending Indexes, Grouping, Regular Expressions, Character Sets, Cost Model, and Histograms (SQL)
  • Geography support. Spatial Reference Systems (SRS), as well as SRS aware spatial datatypes, spatial indexes, and spatial functions.
  • Remote management, Undo tablespace management, and new instant DDL.
  • OpenSSL improvements, new default authentication, SQL Roles, breaking up the super privilege, password strength, and more.

Check out the rest of this post for more of the overview or MySQL's official announcement for the full details.

tagged: mysql8 release feature overview performance database

Link: https://symfony.fi/entry/mysql-8-0-released-with-new-features-and-improved-performance

Ayesh Karunaratne:
What's new and changing in PHP 7.3
Apr 23, 2018 @ 10:40:01

Looking forward to the next larger release of the PHP language - PHP 7.3 - Ayesh Karunaratne has written up a post on his site sharing some of the new things that are coming and changes that will be made.

This is a live document (until PHP 7.3 is released as generally available) on changes and new features to expect in PHP 7.3, with code examples, relevant RFCs, and the rationale behind them, in their chronological order.

Currently there are five items on his list of features/changes approved and implemented for the 7.3 release:

  • Heredoc and Nowdoc syntax requirements are more relaxed
  • Allow trailing comma in function and method calls
  • Option to make json_encode and json_decode throw exceptions on errors
  • References in list()
  • Introduced is_countable() function

While each item is a link to the actual RFC with more detail, he spends the rest of the post going through each and briefly outlining what they offer and code examples of them in use.

tagged: php73 feature rfc changing new list

Link: https://ayesh.me/Upgrade-PHP-7.3