Login   Register  
PHP Classes
elePHPant
Icontem

Added a get($key) function

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Dictionary  >  All threads  >  Added a get($key) function  >  (Un) Subscribe thread alerts  
Subject:Added a get($key) function
Summary:I Added a get($key) function
Messages:1
Author:Fred Rosenbaum
Date:2010-08-28 20:36:43
 

  1. Added a get($key) function   Reply  
Picture of Fred Rosenbaum
Fred Rosenbaum
2010-08-28 20:36:43
Looking for a PHP dictionary implementation, this is the first one I looked at. It is small, and works. I like that.

I have added a get($key) function, defined in the interface and implemented in the class. I may add more functionality to make it more like the C# and C++ STL equivalents as that is what I am used to.

In IDictionary:
public function get( $key );

In Dictionary:
public function get( $key )
{
if ( !self::exists($key) )
throw new Exception("The given key does not exist");

return $this->items[$key];
}