Location: PHPKode > scripts > Logo Interpreter > logo-interpreter/class.storage.php
<?php

  // Freely distributed as you want
  // class.storage.php

  // Author: Zhihua Lai
  // Example URL: http://www.zhihua-lai.com/?do=Crap.Logo
	
  class Storage
  {
    var $_pairs=array();
    
    function Storage($pairs=array())
    {
      if (count($pairs))
      {
        $this->_pairs=$pairs;	
      }
    }
    
    function getSize()
    {
      return (count($this->_pairs));
    }
    
    function keys()
    {
      return (array_keys($this->_pairs));
    }
    
    function values()
    {
      return (array_values($this->_pairs));
    }
    
    function isVar($name)
    {
      return array_key_exists($name, $this->_pairs);
    }
    
    function getVar($name)
    {
      return (isset($this->_pairs[$name])) ? ($this->_pairs[$name]) : (NULL);
    }
    
    function delVar($name)
    {
      if (isset($this->_pairs[$name]))
      {
        unset($this->_pairs[$name]);
      }
    }
    
    function _setVar($name, $value)
    {
      $this->delVar($name);
      $this->_pairs[$name] = $value;
    }
   
    function getAll()
    {
      return ($this->_pairs);	
    }
    
    function _print()
    {
      print_r($this->_pairs);
    }
    
  };
  
?>
Return current item: Logo Interpreter