<?PHP
/*
* Project: Absynthe Debug
* File: adebug.class.php5
* Author: Sylvain 'Absynthe' Rabot <hide@address.com>
* Website: http://absynthe.is.free.fr/adebug/
* Version: alpha 1
* Date: 07/06/2007
* License: LGPL
*/
/**
* This classe overloads tests functions of PHP
* in order to inform the evil user of mistakes
* he does by using your code like using wrong type
* of arguments in function's calls.
*
* It's really simple to implement, just create an object: $debug = new adebug();
* And after replace all PHP's functions begining by 'is_' by '$debug->is_'.
* Check the code under for a better understanding.
*
* You can also use it to debug you code, not only in classes.
* After debugging is done just change constructor to : $debug = new adebug(false);
* to disable debugging mode and functions' behaviour will be the same as PHP's.
*
* <code>
*
* class foo
* {
* $debug = new adebug();
*
* public function __constructor($foo)
* {
* // If $foo is not a boolean an error will be triggered
* if ($debug->is_bool($foo))
* {
* // Your code
* }
*
* // If $foo is a boolean an error will be triggered
* if ($debug->is_bool($foo, true))
* {
* // Your code
* }
*
* // No debugging, the method will only return the result of the test
* if ($debug->is_bool($foo, null))
* {
* // Your code
* }
* }
*
* public function afunction($foo, $foo1, $foo2, $foo3)
* {
* // if $foo is really a integer nothing is done otherwise an error is triggered and execution stops.
* $debug->is_int($foo);
*
* // Same behaviour as above, false is default value for second argument in all functions.
* $debug->is_int($foo, false);
*
* // Error will be triggered if $foo1 is an integer.
* $debug->is_int($foo1, true);
*
* // Error message will contain path of the file where error happened.
* $debug->is_int($foo2, false, __FILE__);
*
* // Error message will contain path and line's number of the file where error happened.
* $debug->is_int($foo3, false, __FILE__, __LINE__);
*
* // traitment
* return $foo + $foo1 + $foo2;
* }
* }
*
* </code>
*/
class adebug
{
/* Var headers
---------------------------------------- */
private $working = true;
private $error_type = E_USER_ERROR;
private $messages = array();
/**
* Classe's constructor
*
* @param boolean $working : Debugging stauts
* @param constant $error_type : error type
*/
public function __construct($working = true, $error_type = E_USER_ERROR)
{
if (is_bool($working))
$this->working = $working;
if (is_int($error_type))
$this->error_type = $error_type;
/* Error messages init
---------------------------------------- */
$this->messages[is_array][false] = "Content of given variable is not in the tested array.";
$this->messages[is_array][true] = "Content of given variable is in the tested array but should not be.";
$this->messages[is_a][false] = "Object given is not instance of '\$class'.";
$this->messages[is_a][true] = "Object given is instance of '\$class' but should not be.";
$this->messages[is_array][false] = "Content of given variable is not an array.";
$this->messages[is_array][true] = "Content of given variable is an array but should not be.";
$this->messages[is_bool][false] = "Content of given variable is not a boolean.";
$this->messages[is_bool][true] = "Content of given variable is a boolean but should not be.";
$this->messages[is_callable][0][false] = "Name given is not a function.";
$this->messages[is_callable][0][true] = "Name given is a function but should not be.";
$this->messages[is_callable][1][false] = "Name given is not a method of \$var[0].";
$this->messages[is_callable][1][true] = "Name given is a method of \$var[0] but should not be.";
$this->messages[is_dir][false] = "Path given is not a directory.";
$this->messages[is_dir][true] = "Path given is a directory but should not be.";
$this->messages[is_double][false] = "Content of given variable is not a double.";
$this->messages[is_double][true] = "Content of given variable is a double but should not be.";
$this->messages[is_executable][false] = "Path given is not an executable file.";
$this->messages[is_executable][true] = "Path given is an executable file but should not be.";
$this->messages[is_file][false] = "Path given is not a file.";
$this->messages[is_file][true] = "Path given is a file but should not be.";
$this->messages[is_finite][false] = "Content of given variable is not finite.";
$this->messages[is_finite][true] = "Content of given variable is finite but should not be.";
$this->messages[is_float][false] = "Content of given variable is not a float.";
$this->messages[is_float][true] = "Content of given variable is a float but should not be.";
$this->messages[is_infinite][false] = "Content of given variable is not infinite.";
$this->messages[is_infinite][true] = "Content of given variable is infinite but should not be.";
$this->messages[is_int][false] = "Content of given variable is not an integer.";
$this->messages[is_int][true] = "Content of given variable is an integer but should not be.";
$this->messages[is_integer][false] = "Content of given variable is not an integer.";
$this->messages[is_integer][true] = "Content of given variable is an integer but should not be.";
$this->messages[is_link][false] = "Path given is not a link.";
$this->messages[is_link][true] = "Path given is a link but should not be.";
$this->messages[is_long][false] = "Content of given variable is not a long integer.";
$this->messages[is_long][true] = "Content of given variable is a long integer but should not be.";
$this->messages[is_nan][false] = "Content of given variable is a number.";
$this->messages[is_nan][true] = "Content of given variable is not a number but should not be.";
$this->messages[is_null][false] = "Content of given variable is not null.";
$this->messages[is_null][true] = "Content of given variable is null but should not be.";
$this->messages[is_numeric][false] = "Content of given variable is not numeric.";
$this->messages[is_numeric][true] = "Content of given variable is numeric but should not be.";
$this->messages[is_object][false] = "Content of given variable is not an oject.";
$this->messages[is_object][true] = "Content of given variable is an object but should not be.";
$this->messages[is_readable][false] = "Path given is not readable.";
$this->messages[is_readable][true] = "Path given is readable but should not be.";
$this->messages[is_real][false] = "Content of given variable is not a real.";
$this->messages[is_real][true] = "Content of given variable is a real but should not be.";
$this->messages[is_resource][false] = "Content of given variable is not a resource.";
$this->messages[is_resource][true] = "Content of given variable is a resource but should not be.";
$this->messages[is_scalar][false] = "Content of given variable is not a scalar.";
$this->messages[is_scalar][true] = "Content of given variable is a scalar but should not be.";
$this->messages[is_string][false] = "Content of given variable is not a string.";
$this->messages[is_string][true] = "Content of given variable is a string but should not be.";
$this->messages[is_subclass_of][false] = "Object given is not subclass of '\$class'.";
$this->messages[is_subclass_of][true] = "Object given is subclass of '\$class' but should not be.";
$this->messages[is_writable][false] = "Path given is not writable.";
$this->messages[is_writable][true] = "Path given is writable but should not be.";
$this->messages[is_writeable][false] = "Path given is not writable.";
$this->messages[is_writeable][true] = "Path given is writable but should not be.";
/* PHP error handler
---------------------------------------- */
error_reporting(E_ALL ^ E_NOTICE);
}
/**
* Turns on debugging mode
*/
public function switch_on()
{
$this->working = true;
}
/**
* Turns off debugging mode
*/
public function switch_off()
{
$this->working = false;
}
/**
* Overload of trigger_error function
*
* @param string $message : Content of the error message
* @param string $file : File where the error happened
* @param int $line : Line where the error happened
*/
public function trigger_error($message, $file = null, $line = null)
{
if (!is_null($file) && !is_null($line))
$message .= " This error has been triggered from <strong>'{$file}'</strong> at line <strong>{$line}</strong> and called ";
else if (!is_null($file))
$message .= " This error has been triggered from <strong>'{$file}'</strong> and called ";
else if (!is_null($line))
$message .= " This error has been triggered at line <strong>{$line}</strong> and called ";
else
$message .= " This error has been called ";
trigger_error($message, $this->error_type);
}
/**
* Checks if the var is an array
*
* @param mixed $needle : tested var
* @param array $array : tested array
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function in_array($needle, $array, $trigger_when = false, $file = null, $line = null)
{
if ($this->working && $this->is_array($array, false, __FILE__, __LINE__))
if(in_array($needle, $array) === $trigger_when)
$this->trigger_error($this->messages[in_array][$trigger_when], $file, $line);
return in_array($needle, $array);
}
/**
* Checks if the object is of this class or has this class as one of its parents
*
* @param anything $object : tested var
* @param string $class : tested class
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_a($object, $class, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_a($object, $class) === $trigger_when)
$this->trigger_error(eval("return \"".$this->messages[is_a][$trigger_when]."\";"), $file, $line);
return is_a($object, $class);
}
/**
* Checks if the var is an array
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_array($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_array($var) === $trigger_when)
$this->trigger_error($this->messages[is_array][$trigger_when], $file, $line);
return is_array($var);
}
/**
* Checks if the var is a boolean
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_bool($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_bool($var) === $trigger_when)
$this->trigger_error($this->messages[is_bool][$trigger_when], $file, $line);
return is_bool($var);
}
/**
* Verifies that the contents of a variable can be called as a function
*
* @param mixed $var : tested var
* @param boolean $syntax_only
* @param string $callable_name
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return unknown
*/
public function is_callable($var, $syntax_only = null, &$callable_name = null, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
{
if (is_null($syntax_only))
{
if(is_callable($var, false) === $trigger_when)
$this->trigger_error($this->messages[is_callable][0][$trigger_when], $file, $line);
}
else
{
if(is_callable($var, $syntax_only) === $trigger_when)
$this->trigger_error(eval("return \"".$this->messages[is_callable][1][$trigger_when]."\";"), $file, $line);
}
}
return is_callable($var, $syntax_only, $callable_name);
}
/**
* Checks if the var is the path of a directory
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_dir($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_dir($var) === $trigger_when)
$this->trigger_error($this->messages[is_dir][$trigger_when], $file, $line);
return is_dir($var);
}
/**
* Checks if the var is a double
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_double($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_double($var) === $trigger_when)
$this->trigger_error($this->messages[is_dir][$trigger_when], $file, $line);
return is_double($var);
}
/**
* Checks if the var is the path of a file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_file($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_file($var) === $trigger_when)
$this->trigger_error($this->messages[is_file][$trigger_when], $file, $line);
return is_file($var);
}
/**
* Checks if the var is the path of an executable file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_executable($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_executable($var) === $trigger_when)
$this->trigger_error($this->messages[is_executable][$trigger_when], $file, $line);
return is_executable($var);
}
/**
* Checks if the var is a finite
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_finite($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_finite($var) === $trigger_when)
$this->trigger_error($this->messages[is_finite][$trigger_when], $file, $line);
return is_finite($var);
}
/**
* Checks if the var is the path of a float
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_float($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_float($var) === $trigger_when)
$this->trigger_error($this->messages[is_float][$trigger_when], $file, $line);
return is_float($var);
}
/**
* Checks if the var is an infinite
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_infinite($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_infinite($var) === $trigger_when)
$this->trigger_error($this->messages[is_infinite][$trigger_when], $file, $line);
return is_infinite($var);
}
/**
* Checks if the var is an integer
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_int($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_int($var) === $trigger_when)
$this->trigger_error($this->messages[is_int][$trigger_when], $file, $line);
return is_int($var);
}
/**
* Checks if the var is an integer
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_integer($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_integer($var) === $trigger_when)
$this->trigger_error($this->messages[is_integer][$trigger_when], $file, $line);
return is_integer($var);
}
/**
* Checks if the var is the path of a link
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_link($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_link($var) === $trigger_when)
$this->trigger_error($this->messages[is_link][$trigger_when], $file, $line);
return is_link($var);
}
/**
* Checks if the var is a long
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_long($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_long($var) === $trigger_when)
$this->trigger_error($this->messages[is_long][$trigger_when], $file, $line);
return is_long($var);
}
/**
* Checks if the var is not o number
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_nan($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_nan($var) === $trigger_when)
$this->trigger_error($this->messages[is_nan][$trigger_when], $file, $line);
return is_nan($var);
}
/**
* Checks if the var is null
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_null($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_null($var) === $trigger_when)
$this->trigger_error($this->messages[is_null][$trigger_when], $file, $line);
return is_null($var);
}
/**
* Checks if the var is a number
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_numeric($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_numeric($var) === $trigger_when)
$this->trigger_error($this->messages[is_numeric][$trigger_when], $file, $line);
return is_numeric($var);
}
/**
* Checks if the var is an object
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_object($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_object($var) === $trigger_when)
$this->trigger_error($this->messages[is_object][$trigger_when], $file, $line);
return is_object($var);
}
/**
* Checks if the var is the path of a readable file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_readable($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_readable($var) === $trigger_when)
$this->trigger_error($this->messages[is_readable][$trigger_when], $file, $line);
return is_readable($var);
}
/**
* Checks if the var is a real
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_real($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_real($var) === $trigger_when)
$this->trigger_error($this->messages[is_real][$trigger_when], $file, $line);
return is_real($var);
}
/**
* Checks if the var is a ressource
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_resource($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_resource($var) === $trigger_when)
$this->trigger_error($this->messages[is_resource][$trigger_when], $file, $line);
return is_resource($var);
}
/**
* Checks if the var is a scalar
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_scalar($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_scalar($var) === $trigger_when)
$this->trigger_error($this->messages[is_scalar][$trigger_when], $file, $line);
return is_scalar($var);
}
/**
* Checks if the var is a string
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_string($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_string($var) === $trigger_when)
$this->trigger_error($this->messages[is_string][$trigger_when], $file, $line);
return is_string($var);
}
/**
* Checks if the object is an instance of the subclass
*
* @param anything $object : tested var
* @param string $class : class name
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_subclass_of($object, $class, $trigger_when = false, $file = null, $line = null)
{
if ($this->working && $this->is_object($object, false, __FILE__, __LINE__) && $this->is_string($class, false, __FILE__, __LINE__))
if(is_subclass_of($object, $class) === $trigger_when)
$this->trigger_error(eval("return \"".$this->messages[is_subclass_of][$trigger_when]."\";"), $file, $line);
return is_subclass_of($object, $class);
}
/**
* Checks if the var is the path of a successful uploaded file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_uploaded_file($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_uploaded_file($var) === $trigger_when)
$this->trigger_error($this->messages[is_uploaded_file][$trigger_when], $file, $line);
return is_uploaded_file($var);
}
/**
* Checks if the var is the path of a writeable file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_writable($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_writable($var) === $trigger_when)
$this->trigger_error($this->messages[is_writable][$trigger_when], $file, $line);
return is_writable($var);
}
/**
* Checks if the var is the path of a writeable file
*
* @param mixed $var : tested var
* @param boolean $trigger_when : when a error is triggered
* @param string $file : path of the file where the error happened
* @param int $line : line of the file where the error happened
* @return boolean
*/
public function is_writeable($var, $trigger_when = false, $file = null, $line = null)
{
if ($this->working)
if(is_writeable($var) === $trigger_when)
$this->trigger_error($this->messages[is_writeable][$trigger_when], $file, $line);
return is_writeable($var);
}
/**
* Dump the structure of an object / array
*
* @param mixed $var : Var you want to dump
* @param boolean $display : Set to false if you want to return the html instead of echo it
* @param boolean $first : don't touch it
* @return string
*/
public static function dump($var, $display = true, $first = true)
{
$i = 0;
/* Structure check
------------------------------------------------ */
if (!is_array($var) && !is_object($var))
throw new Exception('Structure is not an array or an object.');
$html = "<table width=\"100%\" border=\"2\">\n";
if ($first)
{
if (is_object($var))
$html .= "\t<tr><td bgcolor='#000' style='text-align: center; color: #FFF' colspan='2'><strong>".gettype($var)." : ".get_class($var)."</strong></td></tr>\n";
else if (is_array($var))
$html .= "\t<tr><td bgcolor='#000' style='text-align: center; color: #FFF' colspan='2'><strong>".gettype($var)."(".count($var).")</strong></td></tr>\n";
}
/* Fetch
------------------------------------------------ */
foreach ($var as $key => $a)
{
if (is_object($a))
{
$html .= "\t<tr><td bgcolor='#FFA500' style='text-align: center'><strong>$key</strong> : ".get_class($a)."</td><td>";
$html .= self::dump($a, false, false);
$html .= "</td></tr>\n";
}
elseif (is_array($a))
{
$html .= "\t<tr><td bgcolor='#DD0000' style='text-align: center'><strong>$key</strong> : ".gettype($a)."(".count($a).")</td><td>\n";
$html .= self::dump($a, false, false);
$html .= "</td></tr>\n";
}
else if (is_int($a) || is_float($a) || is_double($a))
{
if (empty($a) && $a !== 0)
$html .= "\t<tr bgcolor='#ccc000'><td><strong>$key</strong> : ".gettype($a)."</td><td> </td></tr>\n";
else
$html .= "\t<tr bgcolor='#ccc000'><td><strong>$key</strong> : ".gettype($a)."</td><td>".$a."</td></tr>\n";
}
else if ($array = @unserialize($a))
{
$html .= "\t<tr><td bgcolor='#00CC33' style='text-align: center'><strong>$key</strong> : Serial(".strlen($a).")</td><td>";
$html .= self::dump($array, false, false);
$html .= "</td></tr>\n";
}
else if (is_string($a))
{
$html .= "\t<tr bgcolor='#eee000'><td><strong>$key</strong> : ".gettype($a)."(".strlen($a).")</td><td>".nl2br(str_replace(' ', ' ', htmlspecialchars($a)))."</td></tr>\n";
}
else if (is_bool($a))
{
$b = $a === true ? 'TRUE' : 'FALSE';
$html .= "\t<tr bgcolor='#00ee00'><td><strong>$key</strong> : ".gettype($a)."</td><td>".$b."</td></tr>\n";
}
$i++;
}
if ($i == 0)
$html .= "\t<tr><td><i>Array is EMPTY or OBJECT is not Iterable</i></td></tr>\n";
$html .= "</table>\n";
/* Return
------------------------------------------------ */
if ($display)
echo $html;
else
return $html;
}
}
?>