3v4l.org

run code in 300+ PHP versions simultaneously
<?php $today = new DateTime(); $birthdate = new DateTime("1973-04-18"); $interval = $today->diff($birthdate); echo $interval->format('%y years'); $Birth = new PHPDateTime('@1973-04-18'); $Other = new PHPDateTime('@' . time()); echo $Birth->diff($Other)->format('%y');

preferences:
32.78 ms | 402 KiB | 5 Q