PHP default values with array_merge

In PHP there is no option to provide default values for an associative array as an argument.

E.g. (is not possible)

function test($args = array('first' => 1, 'second' => 2, 'third' => 3)) {
  // some PHP code
}

In order to solve that issue one may use array_merge function.

Example code:

function test($args) {
  $args = array_merge(
    array('first' => 1, 'second' => 2, 'third' => 3),
    $args
  );

  // some PHP code
}

In the example above $args variable will have default values for first, second and third key if there is no value provided.