mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
26 lines
437 B
Markdown
26 lines
437 B
Markdown
|
---
|
||
|
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>
|