Eng | Rus
 
Education -> Solutions -> Tracing php application with xdebug
 
 
 
Simple Seo Solutions
SEO and Promotion
sites
VoiceNotebook.com
Speech to text for AndroidAndroid speech to text

Tracing php application with xdebug

The simplest method of debugging code in php is the echo function. But sometimes we cannot use it - for example ajax calls and etc. The function traces of xdebug is the good method of showing variables and function calls. The latest xamp packages include Xdebug too. To activate it we need only to uncomment line zend_extension = "C:\xampp\php\ext\php_xdebug.dll". After that, we must set xdebug.collect_params = 3 in xdebug section of php.ini. This setting give us the opportunity to show argument values in the function calls. Then we can put xdebug_start_trace in any places of our code:

//some function
	xdebug_start_trace('c:/data/2');
		//... some program code
		xdebug_var_dump($some_var);
	xdebug_stop_trace(); 
//another function		
	 xdebug_start_trace('c:/data/3');
	 //... some program code
		xdebug_var_dump($another_var);
	xdebug_stop_trace();
The tricks is in using any function with our variable as a argument, we have used xdebug_var_dump, but we can use any others. So, we get two files with the list of function calls and values of their arguments.

© prjsoft.ru