Skip to content

Instantly share code, notes, and snippets.

@astorm
Created June 19, 2016 00:54
Show Gist options
  • Save astorm/0e412fb15b77b26883de909a5d7ed929 to your computer and use it in GitHub Desktop.
Save astorm/0e412fb15b77b26883de909a5d7ed929 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
protected $default='default';
public function test()
{
$this->default = 'not default';
echo $this->addChild(),"\n";
}
protected function addChild($level=0)
{
if($level > 10)
{
return 'Done';
}
$level++;
echo "Incremeneted to $level\n";
echo ' ' , $this->default,"\n";
return self::addChild($level);
}
}
$object = new Foo;
$object->test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment