Skip to content

Instantly share code, notes, and snippets.

Created January 19, 2016 19:33
Show Gist options
  • Save anonymous/a1cc1c8c2756e6314536 to your computer and use it in GitHub Desktop.
Save anonymous/a1cc1c8c2756e6314536 to your computer and use it in GitHub Desktop.
<?php
public function options()
{
$value = $this->value;
$mapped = array_map(function($k, $v) use ($value) {
return array(
'value' => $k,
'display' => $v,
'selected' => ($value === $k),
);
}, array_keys($this->options), $this->options);
return $mapped;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment