PHP clock variables

Does PHP have the ability to watch a variable (or an object property) and run a function when its value changes, like the Gecko Javascript watch function ?

+4
source share
2 answers

XDebug may have this, but I don't know for sure.

If you are 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; } 
+1
source

This would be possible when using XDebug next to an IDE, such as an eclipse.

0
source

All Articles