PHP - Debugging

php

http://www.sitepoint.com/interactive-php-debugging-psysh
http://www.sitepoint.com/install-xdebug-phpstorm-vagrant/
http://www.sitepoint.com/debugging-xdebug-sublime-text-3

http://unitstep.net/blog/2009/01/26/getting-xdebug-to-work-with-apachexampp-to-debug-php/ - Getting Xdebug to work with Apache/XAMPP to debug PHP
http://devzone.zend.com/article/2803-Introducing-xdebug - Introducing xdebug
http://devzone.zend.com/article/2871-Tracing-PHP-Applications-with-xdebug - Tracing PHP Applications with xdebug
http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug - Profiling PHP Applications With xdebug
http://devzone.zend.com/article/2930-Debugging-PHP-applications-with-xdebug - Debugging PHP applications with xdebug
http://devzone.zend.com/article/2955-Creating-Code-Coverage-Statistics-with-xdebug - Creating Code Coverage Statistics with xdebug
http://phpmaster.com/debugging-and-profiling-php-with-xdebug

If you are on Windows, Google for XDebug and XAMPP

What are PHP functions that are related to debugging?

debug_backtrace
debug_print_backtrace
error_get_last
error_log
error_reporting
restore_error_handler
restore_exception_handler
trigger_error
user_error

How to use error_log?

error_log(print_r($arr, true), 3, 'debug log');

What is the limitation with print_r, var_dump, and var_export?

print_r(), var_dump(), and var_export() will show protected and private properties of objects with PHP5. Static class member will not be shown.

print_r() will move the array pointer to the end. Use reset() to bring it back to the beginning.

How to use print_r?

print_r($expression, [bool $as_string = false]);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License