rfc:namedparameters

This is an old revision of the document!


Request for Comments: Named Parameters

Introduction

This document is a placeholder for a future RFC on implementing Named Parameters. This project needs an owner.

Named Parameters is a topic that has been raised many times over the years. The pros and cons are captured in a variety of emails. Now PHP has an RFC process the discussion should be recorded in an RFC (this is yet to be done).

Paris Meeting 2005

As a start, a summary is contained in the Paris meeting minutes from 2005:

Issue

The functionality of named parameters was suggested. Named parameters allow you to “skip” certain parameters to functions. If it would be implemented, then it might look like:

<?php
function foo ($a = 42, $b = 43, $c = 44, $d = 45)
{
      // echos 42, 53, 54, 45
      echo "$a $b $c $d\n";
}

foo(c => 54, b => 53);
?>

Discussion

We don't see the real need for named parameters, as they seem to violate PHP's KISS principle. It also makes for messier code.

Conclusions

We do not want to add it.

rfc/namedparameters.1334375707.txt.gz · Last modified: 2017/09/22 13:28 (external edit)