PHP 8 has named parameters in function calls, Kotlin has named parameters in
function calls.

Kotlin has this handy feature that you can put parameters with defaults
before normal ones. Those parameters can then only be used by naming them.
See also: https://kotlinlang.org/docs/functions.html#default-arguments

This is very useful because I can add an optional parameter to a function
and prevent users of my function from using the parameter in a positional
way. This way I don't have to make a compatibility promise to never change
the position of this parameter.

If I try the same thing in PHP 8.0 I get a Deprecated warning and if I try
it in PHP 8.1 I get something that I don't understand:
https://3v4l.org/cg4DA

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to