Is it possible to hide a specific class fields from print_r ?
I built upon Meir's solution to extend it to work with multiple objects of the class. Here is my solution:
hiddenVarKey) {
$this->hiddenVarKey = sha1(rand());
}
if(!empty($set_to_new_val)){
self::$hiddenVarMap[$this->hiddenVarKey] = $set_to_new_val;
}
return self::$hiddenVarMap[$this->hiddenVarKey];
}
}
$test = new myClass;
$test->visibleVar = range(1,5);
print_r($test);
print_r($test->visibleVar);
$test->hiddenVar(range(100,105));
print_r($test);
print_r($test->hiddenVar());
?>