Does PHP have the ability to watch a variable (or object property) and run a function when its value changes, similar to Javascript's watch function?
+1
A:
XDebug might have this, but I don't know for sure.
If you're trying to debug a member variable on an object, you can use overloading:
public function __set($var, $val)
{
if ($var == 'interesting') {
echo "$var set to: ";
var_dump($val);
}
$this->$var = $val;
}
ieure
2008-12-22 03:01:10
According to PHP docs (http://us3.php.net/manual/en/language.oop5.overloading.php) : "__set() is run when writing data to inaccessible members." It doesn't filter all member accesses.
strager
2008-12-22 03:03:20
A:
This would be possible when using XDebug along side an IDE like eclipse.
Shoan
2008-12-22 11:55:33