php8.5
Home/ Manual/ xhprof / functions/ xhprof_sample_disable

xhprof_sample_disable

PHP function Edit on GitHub ✎

(PECL xhprof >= 0.9.0)

Stops xhprof sample profiler

Description

xhprof_sample_disable(): array|null

Stops the sample mode xhprof profiler, and returns the profile info.

Parameters Parameters

Return Values

An array of xhprof sample data, from the run. Returns null if profiling is not enabled.

Examples

xhprof_sample_disable() example

php
<?php
xhprof_sample_enable();

for ($i = 0; $i <= 10000; $i++) {
    $a = strlen($i);
    $b = $i * $a;
    $c = rand();
}

$xhprof_data = xhprof_sample_disable();

print_r($xhprof_data);
?>

The above example will output something similar to:

output
Array
(
    [1272935300.800000] => main()
    [1272935300.900000] => main()
)

Source: reference/xhprof/functions/xhprof-sample-disable.xml · from the official PHP manual (php/doc-en)