I am trying to imitate the hashset function of Visual Basic. For this of course, I must declare a variable globally and here it begins to fail already; I have tried it without the interpreter global but also here it does not work at all.You might have better suggestions as I could immit, or even improvements for the code?
I look forward to answers and suggestions for improvement.
<?php
/**
*
*/
global $Hashset = array();
class stimpackZ
{
public function hash_add($NAME,$DATA) {
if ($NAME = 0) {
$name_of_hash = count($Hashset) + 1;
global $Hashset[$name_of_hash] = $DATA;
echo $name_of_hash;
return 1;
} else {
$name_of_hash = $NAME;
$Hashset[$name_of_hash] = $DATA;
return 1;
}
}
public function hash_create($NAME) {
}
public function hash_get() {
return $Hashset;
}
public function hash_cls() {
global $Hashset = null;
global $Hashset = array();
return 1;
}
public function hash_del($ARG,$DATA) {
switch ($ARG) {
case 0:
$key = array_search($DATA, global $Hashset);
unset(global $Hashset[$key]);
return 1;
break;
case 1:
unset(global $Hashset[$DATA]);
return 1;
break;
default:
return 0;
break;
}
}
public function hash_test() {
var_dump(global $Hashset);
}
}
?>