Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Last active August 29, 2015 14:00
Show Gist options
  • Save clemherreman/11259435 to your computer and use it in GitHub Desktop.
Save clemherreman/11259435 to your computer and use it in GitHub Desktop.
WTF collection
<?php
class Collection
{
/**
* Gets an item from the collection
*
* @param $item
* @return string|null
*/
public function get($item)
{
if ($key = array_search($item, $this->toArray())) {
return parent::offsetGet($key);
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment