profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

PHP8 Parameters

In this randomly categorized post let's cover everything parameter releated in PHP81

Named arguments2

You can now pass arguments to a function by specifying the value name

<?php
function tralala(string $a, string $b, string $c)
{
    echo $a.' '.$b.' '.$c;
}

tralala(b: 'la', c: 'la', a: 'tra');
// tra la la

Trailing comma in parameters lists3

Like in es20174 trailing commas are now allowed in parameter lists

<?php

function tralala(string $a, string $b, string $c,) {}