Skip to content

Instantly share code, notes, and snippets.

@aurimasniekis
Created March 23, 2014 18:41
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 aurimasniekis/9727593 to your computer and use it in GitHub Desktop.
Save aurimasniekis/9727593 to your computer and use it in GitHub Desktop.
<?php
class Obj {
public $mod = false;
}
class Example {
protected $items = array();
public function getItems()
{
return $this->items;
}
public function addItem($item)
{
$this->items[] = $item;
}
}
$item = new Obj();
$example = new Example();
$example->addItem($item);
$items = $example->getItems();
$items[0]->mod = true;
var_dump($example->getItems());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment