Context
현재 실행되고 있는 함수나 메소드의 맥락을 제공한다.
<?php
function fix_string($a)
{
echo "Called @ ".
xdebug_call_file().
":".
xdebug_call_line().
" from ".
xdebug_call_function();
}
$ret = fix_string(array('Derick'));
?>
Memory
<?php
$text = "coding everybody";
$prev_mem = xdebug_memory_usage();
for($i=0; $i<10; $i++){
$text.=$text;
echo $i.':'.xdebug_memory_usage().':'.(xdebug_memory_usage()-$prev_mem).':'.strlen($text)."\n";
}
?>
실행시간
<?php
echo xdebug_time_index()."\n";
for($i=0; $i<3; $i++){
echo xdebug_time_index()."<br />\n";
sleep(1);
}
?>
데이터 출력
xdebug는 var_dump의 출력 방식을 웹과 CLI에 맞게 변경한다.
<?php
class test {
public $pub = false;
private $priv = true;
protected $prot = 42;
}
$t = new test;
$t->pub = $t;
$data = array(
'one' => 'a somewhat long string!',
'two' => array(
'two.one' => array(
'two.one.zero' => 210,
'two.one.one' => array(
'two.one.one.zero' => 3.141592564,
'two.one.one.one' => 2.7,
),
),
),
'three' => $t,
'four' => range(0, 5),
);
var_dump( $data );
?>
웹에서 실행한 결과

CLI로 실행한 결과 (xdebug.cli_color의 설정값을 2로 했을 때)

전역변수 열람
<?php
ini_set('xdebug.dump.GET', '*');
ini_set('xdebug.dump.SERVER','*');
xdebug_dump_superglobals();
?>

