Comment

Comment by Minor49er

The Match Expression feature is interesting. According to the PHP docs, it can even handle non-identity expression, although the approach seems a little hacky:

https://www.php.net/manual/en/control-structures.match.php#e...

    <?php

    $age = 23;

    $result = match (true) {
        $age >= 65 => 'senior',
        $age >= 25 => 'adult',
        $age >= 18 => 'young adult',
        default => 'kid',
    };
The above example will output:

    string(11) "young adult"
parent Minor49er 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton