function myFunction ($input)
{
print "Input: [$input]";
// Some logic here
$ret = $input*2;
print "Return: [$ret]";
return $ret;
}
$DEBUG - variable to the application's configuration
file.conf.php could hold
variable called $DEBUG and it's value could be set
to true or false.$DEBUG is set to true, debug-information is printed.
require_once("conf/conf.php");
function myFunction ($input)
{
global $DEBUG;
if($DEBUG)
{
print "Input: [$input]";
}
// Some logic here
$ret = $input*2;
if($DEBUG)
{
print "Return: [$ret]";
}
return $ret;
}
Math.min: Input [8,7]$DEBUG is now set to TRUE or FALSE.
=> debug is either on or off.
true or false, we
could use integer 1-10.
class Debug
{
private $className;
public function __construct ( $className )
{
$this->className = $className;
}
public function debug ($functionName, $message, $level = 1) { ... }
}
class Math extends Debug
{
public function __construct () // PHP5
{
parent::__construct("Math");
}
}