colap Posted June 25, 2011 Share Posted June 25, 2011 Hi, Is there any debug($val); command available for php code? How can i add a breakpoint in php code and do Next> to go for the next line like some C++ IDE? Is it possible with php code? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/240386-how-to-debug-php-code/ Share on other sites More sharing options...
wildteen88 Posted June 25, 2011 Share Posted June 25, 2011 Breakpoints have nothing to do with PHP. They are handled by your code editor, specifically IDE's. There are many IDEs available for PHP. A few of them are listed in this thread. If you're using Firefox you can install firebug and firephp. You can then use firephp to debug your code form your browser. Quote Link to comment https://forums.phpfreaks.com/topic/240386-how-to-debug-php-code/#findComment-1234743 Share on other sites More sharing options...
colap Posted June 25, 2011 Author Share Posted June 25, 2011 Is there any debug function ? Quote Link to comment https://forums.phpfreaks.com/topic/240386-how-to-debug-php-code/#findComment-1234782 Share on other sites More sharing options...
wildteen88 Posted June 25, 2011 Share Posted June 25, 2011 You can use functions such as var_dump which will print information about a variables data type and its value. You can also get a backtrace using debug_print_backtrace The most important tool when developing code is setting error_reporting to E_ALL and setting display_errors to on within your php.ini. That way any errors occur they will displayed during runtime. Quote Link to comment https://forums.phpfreaks.com/topic/240386-how-to-debug-php-code/#findComment-1234783 Share on other sites More sharing options...
thehippy Posted June 25, 2011 Share Posted June 25, 2011 Unit testing often is helpful in debugging, phpunit is great for that. If you want more descriptive debugging check out the xdebug extension (xdebug tutorial), its been around for awhile and is supported by many IDEs and other tools (like phpunit). Quote Link to comment https://forums.phpfreaks.com/topic/240386-how-to-debug-php-code/#findComment-1234815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.