class MyClass { public $salary = 50000; public function calculateBonus($multiplier) { return $this->salary * $multiplier; } } $obj = new MyClass(); $obj->salary = 60000; $result = $obj->calculateBonus(2); debug($obj); // outputs object to browser console debug($result); // outputs variable to browser console
$string = "Hello World"; $number = 42; debug($string); // outputs "Hello World" to browser console debug($number); // outputs 42 to browser consoleIn this example, we use the `debug` function to output a string and number variable to the browser console for debugging purposes. The PHP Object Debug library is not a standalone package, but rather a part of the PHP Debugging Tools library.