PHP Classes

Added a get($key) function

Recommend this page to a friend!

      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
Author:Fred Rosenbaum
Date:2010-08-28 20:36:43

  1. Added a get($key) function   Reply   Report abuse  
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];