Return to Snippet

Revision: 28102
at June 30, 2010 22:27 by orenus


Initial Code
//dealing with encapsulation....
class MemCache{
	
	private $mem;
	
	public function MemCache(){
		//some intitialization here...
		$this->mem = array();
	}
	
	public function get($key){
		if (!array_key_exists($key, $this->mem))
			return $this->mem[$key];
		
		//else
		echo "Huston we have a problem!";
	}
	
	public function set($key, $val){
		if (array_key_exists($key, $this->mem))
			echo "Huston...just to let you know that an override occurs here to $key with val: $val";
		
		$this->mem[$key] = $val;
	}
}

Initial URL


Initial Description


Initial Title
Get Weather - Step 6 - More encapsulation - controlling access

Initial Tags
php

Initial Language
PHP