Advent of Functional PHP: Day 2 – Larry Garfield

Advent of Functional PHP: Day 2

Submitted by Larry on 2 December 2021 – 11:46am

In today’s challenge, we’re asked to interpret a series of basic command lines from a file and update the position of our submarine accordingly. It’s basically a graph walk of sorts, with instructions of up, down, and forward. (Apparently you cannot go backward, as in life.)

As with yesterday’s challenge, we could do it imperatively with a foreach() loop and a couple of state variables floating around, but that conflates a whole bunch of different behaviors into one blob of code. We don’t want to do that, so let’s step back and consider the problem more clearly.

Advent of Functional PHP: Day 1 – Larry Garfield

Advent of Functional PHP: Day 1

Today’s challenge asks us to interpret a list of numbers. In the first part, our goal is to determine how many elements in the list are larger than their immediate predecessor.

The imperative way would be to toss it in a `foreach()` loop and track some state along the way. But we want to be functional and avoid “track some state,” because the whole point of functional programming is to avoid tracking state, as tracking state is error prone.

When looking at a foreach-style operation that has some state, my first inclination is to look at a reduce operation. A reduce operation walks over a list and performs the same operation (function) on each item, using the output of the previous iteration as an input. That is, each step takes the output of the previous operation and the next element, and produces an output. It’s quite elegant.

Larry
1 December 2021 – 11:24am

Advent of Code 2021: Functional PHP – Larry Garfield

Advent of Code 2021: Functional PHP

I am planning to participate in Advent of Code this year. For those not familiar with it, it’s a daily coding challenge that runs through December, until Christmas. Mostly it’s just for fun, but some people take it as an opportunity to either push themselves (by solving the puzzles in a language they’re unfamiliar with) or to show off some feature of a language they like, which they then blog about.

In my case, I’ll be solving puzzles in PHP, of course, but specifically using functional techniques. My goal is to demonstrate how functional programming in PHP is not just viable but creates really nice solutions. At least, I hope it works out that way; I haven’t seen any of the challenges yet. πŸ™‚

Larry
29 November 2021 – 6:45pm

Evolving PHP safely – Larry Garfield

Evolving PHP safely

Submitted by Larry on 27 November 2021 – 12:37pm

This past week, the latest PHP RFC, Deprecate Dynamic Properties, passed 2:1. It just barely met the 2/3 vote threshold for passing, which of course can and has been spun in various pro-and-con ways. The RFC covers the change itself fairly well so I won’t go into detail about it here.

The main argument people had against it was that it involves triggering deprecation warnings. Which… is kind of the point. That’s kind of all it does.

This is not the first time that debate has come up, but it’s been coming up more frequently and we, as PHP, need to improve the answer.

(Continue reading this post on PeakD.)

Interview with Ben Ramsey – Voices of the ElePHPant

About

Listen as host Khayrattee Wasseem talks with Ben Ramsey – Release Manager for PHP 8.1 and Staff Engineer at Skillshare. This is a thorough talk about the very beginning of the PHP Community, the early core people that formed the community, the early conferences that was organised namely PHPcon and also about the PHP Appalachia retreat, a deep dive into Ben role as Release Manager for PHP 8.1 and his role as Staff Engineer at Skillshare.

Transcript

Download the PDF for transcript: Ep#365-Interview-Ben-Ramsey

This episode is sponsored by
RingCentral Developers

The post Interview with Ben Ramsey appeared first on Voices of the ElePHPant.

PHP 8.1.0 RC 6 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the release of PHP 8.1.0, RC 6. This is the sixth and final release candidate, continuing the PHP 8.1 release cycle, the rough outline of which is specified in the PHP Wiki. For source downloads of PHP 8.1.0, RC 6 please visit the download page. Please carefully test this version and report any issues found in the bug reporting system. Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the production-ready, general availability release, planned for 25 November 2021. The signatures for the release can be found in the manifest or on the QA site. Thank you for helping us make PHP better.

Ep#364 – Interview with Michael Bodnarchuk – Voices of the ElePHPant

About

Listen as host Khayrattee Wasseem talks with Michael Bodnarchuk creator of Codeception & CodeceptJS. This is a deep dive into the journey of someone who started from scratch creating & releasing opensource softwares.

Transcript

Download the transcript (pdf) Ep364-Interview-Michael-Bodnarchuk

This episode is sponsored by
RingCentral Developers

The post Ep#364 – Interview with Michael Bodnarchuk appeared first on Voices of the ElePHPant.

PHP 8.1.0 RC 5 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the release of PHP 8.1.0, RC 5. This is the fifth release candidate, continuing the PHP 8.1 release cycle, the rough outline of which is specified in the PHP Wiki. For source downloads of PHP 8.1.0, RC 5 please visit the download page. Please carefully test this version and report any issues found in the bug reporting system. Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the sixth and last release candidate (RC 6), planned for 11 November 2021. The signatures for the release can be found in the manifest or on the QA site. Thank you for helping us make PHP better.