9951 explained code solutions for 126 technologies


phpHow to measure execution time


$start = time();
# Other code:
sleep(15);
$time = time() - $start;ctrl + c
$start = time();

assign the current time to a variable called $start

# Other code

the rest of the code to execute

sleep(15);

wait 15 seconds (for testing purposes)

$time = time() - $start;

assign the total time since $start to a variable called $time