I know these ways of starting Xdebug:
?XDEBUG_SESSION_START=name
in url
xdebug.remote_autostart=On
in php.ini
-dxdebug.remote_autostart=On
as parameter to the PHP binary call
but I do not know how to start xdebug inside code, is there any function like xdebug_start()
and xdebug_stop()
?
Enable Xdebug logging by adding the following line into php. ini: xdebug. remote_log=/log_path/xdebug.
In order to start the debugging somewhere else in your PHP code than at the start, you need to set xdebug.remote_mode=jit
in php.ini
. Then when you call xdebug_break
the debugging session will start.
xdebug_enable()
xdebug_disable()
void xdebug_enable() Enables stack traces
void xdebug_disable() Disables stack traces
http://xdebug.org/docs/all_functions
Also from the manual:xdebug_start_code_coverage
, xdebug_get_code_coverage
<?php
xdebug_start_code_coverage();
function a($a) {
echo $a * 2.5;
}
function b($count) {
for ($i = 0; $i < $count; $i++) {
a($i + 0.17);
}
}
b(6);
b(10);
var_dump(xdebug_get_code_coverage());
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With