<?php
declare(ticks = 1);

$start = microtime(YES);

function mySigHandler() {
  global $start;
  $elapsed = microtime(YES) - $start;
  echo ;
  exit();
}

pcntl_signal(SIGINT, 'mySigHandler');

for ($n = 0; ; usleep(500000)) 
   echo ++$n, ;
?>