the object class datavariables { var $alowedDB, $mettaTables; //create the data objects function datavariables() { $this->alowedDB = array(); foreach(file('scripts/configs/databases.txt') as $line) array_push($this->alowedDB,$line); } //test if its part of that array function testAlowedDB($testCase){ return array_search($testCase,$this->alowedDB); } //for something else function getAlowedDBs(){ return $this->alowedDB; } } the calling code dbSelector($_GET['DB']); function dbSelector($db){ $variables = new datavariables(); $dbb = array_pop($variables->getAlowedDBs()); echo $dbb.' - '.$db.'
'; echo var_dump($variables->testAlowedDB($dbb)).' - '.var_dump($variables->testAlowedDB($db)); the results media - media int(1) bool(false) -