Skip to content

Instantly share code, notes, and snippets.

@maddox
Created July 30, 2008 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maddox/3297 to your computer and use it in GitHub Desktop.
Save maddox/3297 to your computer and use it in GitHub Desktop.
## php
function remove_item($item_id){
foreach ($this->items as $index => $item) {
if ($item->id == $item_id){
unset($this->items[$index]);
}
}
}
## ruby
def remove_item(item_id)
items.delete_if {|item| item.id == item_id }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment