PHP Classes

getVar function...

Recommend this page to a friend!

      My Session  >  All threads  >  getVar function...  >  (Un) Subscribe thread alerts  
Subject:getVar function...
Summary:getting error with getVar function when variable doesn't exists
Date:2012-01-15 16:20:48

  1. getVar function...   Reply   Report abuse  
Picture of kaleid kaleid - 2012-01-15 16:20:53
Hi all & hi Marco....

first of all thanks and congratulations for this class; cute and usefull.

While playing around with it, and managing restricted access with this class, i found function getVar was crashing cause, obviusly, in some cases the variable will not exist.

That's why a decide to modify that function as follows:

public function getVar($nome) {
if (array_key_exists($nome, $this->VARS)) return $this->VARS[$nome];
else return -1;

What do you think about this? Have you ever face a similar situation and, in such case, how did you get it working succesfully?

Best regards,