<?php
//Array com os horarios que possam ser imprimidos
$hora = array('13:55:40','13:56:40','13:58:41','13:59:40','14:01:00','14:02:00','14:04:40', '14:05:00','14:07:10','14:08:00','14:10:23', '14:11:23','14:13:39','14:14:23','14:16:39',
'14:17:23','14:19:13','14:20:23','14:22:40', '14:21:23','14:25:07', '14:26:23', '14:55:40');
//Intervalo que o usuario escolherá entre 3, 15, 30 ou 60
$interval = 3;
$val1 = $hora[0];
print $val1;
for ($i=0;$i<(count($hora)-1);$i++) {
$val2 = $hora[$i+1];
$datetime1 = new DateTime($val1);
$datetime2 = new DateTime($val2);
$intervalo = $datetime1->diff($datetime2);
$result = $intervalo->format('%i');
if($result == ($interval-1) || $result == ($interval)){
print ", ".$val2;
$val1 = $val2;
}
}
PD9waHAKCgkvL0FycmF5IGNvbSBvcyBob3JhcmlvcyBxdWUgcG9zc2FtIHNlciBpbXByaW1pZG9zCgkkaG9yYSA9IGFycmF5KCcxMzo1NTo0MCcsJzEzOjU2OjQwJywnMTM6NTg6NDEnLCcxMzo1OTo0MCcsJzE0OjAxOjAwJywnMTQ6MDI6MDAnLCcxNDowNDo0MCcsCgknMTQ6MDU6MDAnLCcxNDowNzoxMCcsJzE0OjA4OjAwJywnMTQ6MTA6MjMnLCAnMTQ6MTE6MjMnLCcxNDoxMzozOScsJzE0OjE0OjIzJywnMTQ6MTY6MzknLAoJJzE0OjE3OjIzJywnMTQ6MTk6MTMnLCcxNDoyMDoyMycsJzE0OjIyOjQwJywgJzE0OjIxOjIzJywnMTQ6MjU6MDcnLCAnMTQ6MjY6MjMnLCAnMTQ6NTU6NDAnKTsKCQoJLy9JbnRlcnZhbG8gcXVlIG8gdXN1YXJpbyBlc2NvbGhlcsOhIGVudHJlIDMsIDE1LCAzMCBvdSA2MAoJJGludGVydmFsID0gMzsKCQoJJHZhbDEgPSAkaG9yYVswXTsKCQoJcHJpbnQgJHZhbDE7CgkKCWZvciAoJGk9MDskaTwoY291bnQoJGhvcmEpLTEpOyRpKyspIHsKCQ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