Skip to content

Instantly share code, notes, and snippets.

@pocky
Created February 14, 2014 10:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pocky/8998956 to your computer and use it in GitHub Desktop.
Save pocky/8998956 to your computer and use it in GitHub Desktop.
Pseudo-Named Argument in PHP (this is a bad idea because you loose type hinting)
<?php
class Foo {
public static function getBar($args)
{
$args += [
'foo' => null,
'bar' => false,
'baz' => null
];
extract($args);
//...
}
}
Foo::getBar(['foo' => 'foo']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment