Skip to content

Instantly share code, notes, and snippets.

@nsanden
Last active August 29, 2015 14:02
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 nsanden/85e71cdbaefda5f4a209 to your computer and use it in GitHub Desktop.
Save nsanden/85e71cdbaefda5f4a209 to your computer and use it in GitHub Desktop.
<?php
class Test {
private $_testMethodArray;
public function testDeleteFromMethodArray()
{
$this->testMethodArray();
unset($this->testMethodArray()[0]);
print_r($this->testMethodArray());
//i want array(2) but im getting array(1, 2)
}
public function testMethodArray()
{
if(!isset($this->_testMethodArray))
{
$this->_testMethodArray = array(1, 2);
}
return $this->_testMethodArray;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment