Category Archives: PHP

Difference between passing objects by reference and without in PHP

Quite often I here, that people don't understand, how to use variables by reference. PHP is not an exception. This will be a very short post in which I will try to make it clear.
First of all we will define simple object class A.

class A
{
	protected $foo;
	
	public function __toString()
	{
		return $this->getFoo();
	}
	
	public function setFoo( $foo )
	{
		$this->foo = $foo;
	}
	
	public function getFoo()
	{
		return $this->foo;
	}
}

Continue reading

Trying to get a hang of MVC

Yesterday I tried to make something that {would | could} be an example of MVC model. At least I thought that I understood how it should work correctly, but... Well in this post you can find a source code of what is done at the moment or you can fork it on http://codaset.com/jeserkin/elite-systems.
Please don't judge for my style of writing and file/folder architecture. It all should be as simple as possible. Maybe not too logical, but still.
Continue reading