This repository contains a set of PHP functions that provide quick and convenient ways to output debug information to the browser. These functions are particularly useful during the development phase for inspecting variable values and program state.
dd()
: Dump variable information and exit the script.dc()
: Log variable information to the browser's console.pr()
: Output human-readable variable information to the browser.
Ensure you have PHP installed on your system to use these functions. These debug functions are compatible with PHP 7.x and above.
Clone the repository to your local development environment:
git clone https://github.com/aotr/easy-php-debug.git
Include the debug_helpers.php
file in your PHP script:
require_once 'path/to/php-debug-function/debug_helpers.php';
To output variable information and stop script execution:
$name = "Jane Doe";
dd($name);
To log information to the browser's console:
$user = ['name' => 'Jane Doe', 'age' => 28];
dc($user);
To output human-readable variable information:
$users = [
['name' => 'Jane Doe', 'age' => 28],
['name' => 'John Smith', 'age' => 35]
];
pr($users);
Contributions are welcome! Please feel free to submit a pull request to improve the functions.
This project is open-sourced software licensed under the MIT license.
The provided debug functions are meant for development use only and should not be used in production environments.