Named parameters: Difference between revisions
Content added Content deleted
(Nimrod -> Nim) |
(Adding a PHP solution of the task.) |
||
Line 947:
e1 e2
k1 k2</pre>
=={{header|PHP}}==
PHP doesn't support named parameters but you can simulate the behavior with PHP arrays.
<lang PHP>function named($args) {
$args += ["gbv" => 2,
"motor" => "away",
"teenage" => "fbi"];
echo $args["gbv"] . " men running " . $args['motor'] . " from the " . $args['teenage'];
}
named(["teenage" => "cia", "gbv" => 10]);</lang>
Output:
<pre>10 men running away from the cia</pre>
=={{header|PicoLisp}}==
|