Month: February 2020
Interview with Yip Moors – Voices of the ElePHPant
Show Notes
Audio
This episode is sponsored by
Using the WordPress REST API
The post Interview with Yip Moors appeared first on Voices of the ElePHPant.
What Is a PHP Function?
The PHP language supports both procedural and object-oriented programming paradigms. In the procedural space, functions are a key building-block for developing and maintaining streamlined applications. In this blog, we will:
Type Matching in PHP – larry@garfieldtech.com
Type Matching in PHP
One of the nice features of Rust is the match
keyword. match
is similar to `switch`, but with two key differences:
- It requires an exhaustive match, that is, every possible value must be accounted for or a default must be provided.
match
is an expression, meaning you can assign the return value of one of its branches to a variable.
That makes match
extremely useful for ensuring you handle all possibilities of an enumerated type, say, if using an Optional
or Either
for error handling. Which… is something I’ve been experimenting with in PHP.
It’s hard to make a PHP equivalent of match
that forces an exhaustive match, as PHP lacks enumerated types. However, emulating an expression match turns out to be pretty easy in PHP 7.4, and kind of pretty, too.
Larry
2 February 2020 – 1:46pm