45

Is it possible in php like in python to have named function parameters? An example use case is:

function foo($username = "", $password = "", $timeout = 10) {

}

I want to override $timeout:

foo("", "", 3);

Ugly. I would much rather do:

foo(timeout=3);
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Justin
  • 42,716
  • 77
  • 201
  • 296

0 Answers0