3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Fake data $data = [ ['start' => '2022-11-03'], ['start' => '2022-11-04'], ['start' => date('Y-m-d')], ]; $now = new DateTime(); foreach($data as $records) { $start = new DateTime($records['start']); $diff = $start->diff(new DateTime()); // Convert days and hours to minutes, and sum them all up to get total // diff in minutes $minutes = ($diff->days * 24 * 60) + ($diff->h * 60) + ($diff->i); echo $start->format('Y-m-d H:i') . " was " . $minutes . " minutes ago\n"; }

preferences:
31.79 ms | 404 KiB | 5 Q