wiki/content/20201112111910-named_arguments.md

27 lines
452 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:04:36 +00:00
date: 20201112
2024-05-06 20:40:05 +00:00
id: 1fbecac8-5649-4612-9430-98d0f3ac2ca8
title: PHP Named Arguments
---
# Description
Allowes named arguments[^1] to be used to access parameters in random
order, as in [JavaScript](20200922162127-named_parameters).
# Syntax
``` php
function tralala(string $a, string $b, string $c)
{
echo $a.' '.$b.' '.$c;
}
tralala(b: 'la', c: 'la', a: 'tra');
// tra la la
```
# Footnotes
[^1]: <https://wiki.php.net/rfc/named_params>