I don’t care what anyone says, I like lots of debug output available in my programs. It helps me crank out code faster with less errors. You can keep a private member called debug and just flip it on and off when you want to see the output. It’s a lot cleaner than interjecting prints and echos all over the place.

<?php
class SomeObject {
private $debug = true;
private $var;
public function __construct($incoming) {
if ($this->debug)
echo "var=[".$var."]<br>";
}
public function getvar() {
return $this->var;
}
public function setvar($var) {
if ($this->var = $var)
return true;
else
return false;
}
}
Adding a public setDebug function lets you turn the output on and off outside the class too.
public function setDebug($bool) {
$this->debug = $bool;
}
I know… such an amateur!